package com.tianqu.tms.entity;

import com.tianqu.tms.core.exception.TmsDaoException;
import com.tianqu.tms.core.util.*;
import com.tianqu.tms.core.util.enums.PlateNumberTypes;
import com.tianqu.tms.dao.*;
import com.tianqu.tms.dto.*;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

public class Car extends ViewListManager {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4935527901804490549L;
	private int isShelve;
	/* 车牌号码 */
	private String carLicense;
	private String tempLicensePlate;
	/* 商户ID */
	private long mId;
	/* 商户名称 */
	private String mName;
	/* 图片地址 */
	private String imgPath;
	/* 入场时间 */
	private Date inputTime;
	/* 处理时间 */
	private Date acceptTime;
	/* id */
	private long id;
	/* 处理状态 */
	private int acceptStatus;

	private int cId;// 车辆id
	private String serial = ""; // 二手车流水号
	private String carOwner = ""; // 车主姓名

	private String vin = ""; // VIN码
	private String engine = ""; // 发动机号
	private String licensePlate = ""; // 车牌号码
	private String newLicensePlate = ""; // 新车牌号码
	private int price; // 出售价格
	private int color; // 颜色， 0:全部颜色都包括 1:黑 2:白 3:灰 4:蓝 5:银 6:红 7:金 8:棕 9:绿
	// 10:黄 11:紫 12:橙
	private String vendorCode = ""; // 车辆厂牌代码 【此数据在检测中心填写，根据行驶证上内容记录】
	private String modelCode = ""; // 车辆型号代码 【此数据在检测中心填写，根据行驶证上内容记录】

	private int displacement; // 发动机排量
	private int gearbox; // 变速箱类型：0:MT 1:AT 2:A/MT 3:无极变速 4:双离合
	private int carUse; // 车辆用途
	// 0:非营运、1:货运、2:营转非、3:出租营转非、4:租赁、5:公路客运、6:公交客运、7:出租客运、8:旅游客运、
	// 9:教练、10:校车、11:危险化学品运输、12:警用、13:救护、14:消防

	private int carType; // 车辆类型：0:轿车、1:微型轿车、2:小型轿车、3:小型客车（轿车）、4:小型越野车、5:出租车、6:租赁、7:旅游客运（公交客运）、
	// 8:小型普通客车、9:微型普通客车、10:中型普通客车、11:大型普通客车、12:农用车、13:轻型普通货车、14:小型货车（栏板）、
	// 15:轻型厢式货车、16:中型普通货车、17:重型自卸货车、18:大吊车、19:大型卧铺客车 20:特种车

	private String regDate = ""; // 登记日期/上牌时间
	private String jqx = ""; // 交强险日期
	private String yearCarefulPeriod = ""; // 年审期限（年检时间）
	private int mileage; // 行驶里程，单位：万公里

	private String sendCardDate = ""; // 行驶证发证日期
	private int cardType; // 号牌种类 0：小型车 1：大型车
	private String registerCardNo = ""; // 登级证书编号
	private int countryStyle = -1; // 国别 -1 未知 0:国产 1：进口
	private int fuelType; // 燃料种类 0:汽油 1:柴油 2:油电混合 3:油气混合

	private String companyContactPerson = ""; // 公司联系人
	private String companyContactPhone = ""; // 公司联系人电话
	private String carOwnerIdCardNo = ""; // 车主身份证号
	private int catClass; // 车辆类型
	private String brandId;// 品牌id
	private String carStyleId;// 车辆款式id
	private int memberId;// 商户id
	private int loadquality; // 核定载质量
	private int passenger; // 核定载客
	private int ownerType; // 车主类别 1:个人 2:企业
	private String ownerCardNo; // 车主身份证号
	private String ownerPhone; // 车主手机号码
	private String ownerAddress; // 车主住址
	private String ownerOrgNo; // 车主组织机构代码证号
	private int attribute; // 附件属性 1:正常 2:盗抢 3:违章 4:抵押 5:盗抢+违章 6:盗抢+抵押 7:违章+抵押
	// 8:盗抢+违章+抵押
	private Date updateTime;// 更新时间
	private int updateUserId = 0;// 更新人员

	private String startTime;// 开始时间
	private String endTime;// 结束时间

	private int cssFlag;// 1,2区别（列表样式灰白区分）
	private int innerType = 1;// 判断是否是待入库部分的数据1：不是2：是
	private String vendorId = "";// 车辆品牌
	private String carName = "";// 车辆名称
	private int num;// 列表的序号
	private String remark;// WL:20150509
	private String photo_1;
	private String photo_2;
	private String photo_3;
	private String photo_4;
	private String photo_5;
	private String photo_6;
	private String photo_7;
	private String photo_8;
	private String imagePath;

	private Date enterTime;
	private Date storageTime;// 入库时间
	private Date insertTime;// 受理时间
	private boolean insertTimeUpadateFlg = false;
	private int carScore;// 1：楼下 2：楼上
	private int registerStatus;// 1:已入库 2：已出库 3：过期 4：取消处理
	private int entryStatus;// 1:待录入 2:照相完了 3：已录入 4：录入完成
	private int status;// 1：正常 2:代办中 3：过户中 ：过户完成
	private int attestStatus;// 1：未认证 2：认证
	private int insertUserId;
	private String priceS;// 列表价格显示
	private int upBsflag = 1;
	private String mileageS;// 表显里程列表显示
	private String transferSerial;// 过户流水号
	private String carScoreS;// 登记楼层
	private String innerTime;// 进出库时间
	private String insertTimeS;// 受理时间
	private String carTypeS;// 车辆类型
	private String transferPrice;// 过户费
	private String doubleTransferPrice;// 二次过户费
	private String detectRemark;
	private String internalScore;
	private String externalScore;

	/** 商户待办车辆列表字段 */
	private String newCarOwner;
	private int agencyprice;
	private String agencypriceS;
	private int extendedprice;
	private String extendedpriceS;
	private Date agencytime;
	private String statusTransfer;
	private String displacementStr;
	private String StorageTimeS;
	private int barCodeNum;// 序列号进出库使用次数
	private int handleType;// 操作类型
	private int isPush;// 是否推送
	private String pushContent;// 推送内容
	private int isMatch;// 车款是否匹对
	private String chgLicensePlateTimes;// 换车牌时间
	private String enterTimes;// 出库时间
	private String storageTimes;// 入库时间
	private int checkStatus;// 车辆查验状态
	private String checkImgPath;// 查验单图片

	/** 库存车辆受理信息 */
	private String checkUserName;// 查验员
	private String checkTime;// 查验时间
	private String checkPriceStatus;// 缴费状态
	private int isExistFlag;// 车辆是否受理
	private int cylc_printNum;// 打印次数
	private int lc_printNum;// 流程表打印次数
	private int cy_printNum;// 查验表打印次数
	private Timestamp tmpStorageTime;
	private Timestamp tmpEnterTime;

	private String configKey;

	private String acceptorImage;// 受理人照片
	private static  DecimalFormat format = new DecimalFormat("###.##");

	public static Car getInstance() {
		Car car = new Car();
		car.setExisting(false);
		return car;
	}

	public String getDetectRemark() {
		return detectRemark;
	}

	public void setDetectRemark(String detectRemark) {
		this.detectRemark = detectRemark;
	}

	public String getInternalScore() {
		return internalScore;
	}

	public void setInternalScore(String internalScore) {
		this.internalScore = internalScore;
	}

	public String getExternalScore() {
		return externalScore;
	}

	public void setExternalScore(String externalScore) {
		this.externalScore = externalScore;
	}

	public Car findCarByLicensePlate(String tempLicensePlate, String licensePlate) throws TmsDaoException {
		boolean carFlag = true;
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		Car car = Car.getInstance();
		dto = carDao.findCarByLicensePlate(tempLicensePlate, licensePlate);
		if (dto != null)
			car.setEntityFromDto(dto);
		return car;
	}

	/**
	 * 查找是否有车牌号相同，状态不为过期的车辆
	 * 
	 * @param licensePlate
	 * @return
	 * @throws TmsDaoException
	 */
	public Car findCarByLicensePlate(String licensePlate, int type) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		Car car = Car.getInstance();
		dto = carDao.findCarByLicensePlate(licensePlate, type);
		if (dto != null) car.setEntityFromDto(dto);
		return car;
	}

	public Car findCar(String licensePlate, int type) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		Car car = Car.getInstance();
		dto = carDao.findCar(licensePlate, type);
		boolean isNull = dto == null;
		if (!isNull) car.setEntityFromDto(dto);
		return isNull ? null : car;
	}
	
	public boolean isUseTempLicensePlate(String licensePlate) throws TmsDaoException {
		boolean ret = false;
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		TempLicensePlate dto = carDao.findTempLicensePlate(licensePlate);
		if (dto != null && dto.getIsUse() == 2)
			ret = true;
		return ret;
	}

	/**
	 * 查找是否有车牌号相同，状态不为过期的车辆
	 * 
	 * @param licensePlate
	 * @return
	 * @throws TmsDaoException
	 */
	public Car insertCarFlagM(String licensePlate) throws TmsDaoException {
		boolean carFlag = true;
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		Car car = Car.getInstance();
		dto = carDao.findCarByLicensePlate(licensePlate, "LICENSEPLATE");
		if (StringUtil.isNullOrBlank(dto.getSerial())) {

		}
		return car;
	}

	/**
	 * 载入商户所有的车辆
	 * 
	 * @param memberId
	 * @return
	 * @throws TmsDaoException
	 */
	// modify by huangheli 20150815 start
	// public List findMemberCar(String memberId) throws TmsDaoException{
	public List findMemberCar(String memberId, int type) throws TmsDaoException {
		// modify by huangheli 20150815 end
		List<MarketCarInfoDto> memberCarList = new ArrayList<MarketCarInfoDto>();
		int sort = 11;
		if (getSortKey() != 2) {
			sort = getSortKey();
		}
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), sort, isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);
		memberCarList = carDao.findMemberCar(memberId, type);
		List carList = new ArrayList();
		int i = 1;
		if (memberCarList != null && memberCarList.size() > 0) {
			for (MarketCarInfoDto dto : memberCarList) {
				Car car = new Car();
				car.setSerial(dto.getSerial());// 车辆ID
				TransferAcceptedInfo transferAcceptedInfo = TransferAcceptedInfo.getInstance();
				transferAcceptedInfo = transferAcceptedInfo.getTransferBybasicCarId(dto.getSerial());
				if (transferAcceptedInfo != null) {
					car.setTransferSerial(transferAcceptedInfo.getSerial());// 过户流水号
				}
				car.setNum(i);// 序号
				car.setLicensePlate(dto.getLicensePlate());// 车牌号码
				if (StringUtil.isNullOrBlank(dto.getCarName())) {
					car.setCarName("-");
				} else {
					car.setCarName(dto.getCarName());// 车辆名称
				}

				if (dto.getCarScore() == 6) { // 登记楼层
					car.setCarScoreS("场外");
				} else if (dto.getCarScore() == 1) {
					car.setCarScoreS("1层");
				} else if (dto.getCarScore() == 2) {
					car.setCarScoreS("2层");
				} else if (dto.getCarScore() == 3) {
					car.setCarScoreS("3层");
				} else if (dto.getCarScore() == 4) {
					car.setCarScoreS("4层");
				} else if (dto.getCarScore() == 5) {
					car.setCarScoreS("5层");
				} else if (dto.getCarScore() == 7) {
					car.setCarScoreS("楼外");
				}
				car.setIsShelve(dto.getIsShelve());
				// 出入库记录
				MarketCarGateInfo marketCarGateInfo = MarketCarGateInfo.getInstance();
				marketCarGateInfo = marketCarGateInfo.findGateInfoBySerial(dto.getSerial());
				if (StringUtil.isNullOrBlank(DateUtil.getTimeByTimeStamp(marketCarGateInfo.getInsertTime()))) {// 最新进出时间
					car.setInnerTime("-");
				} else {
					car.setInnerTime(DateUtil.getTimeByTimeStamp(marketCarGateInfo.getInsertTime()));
				}

				if (dto.getPrice() == 0) {// 预售价格(元)
					car.setPriceS("-");
				} else {
					car.setPriceS(StringUtil.addDH(Integer.toString(dto.getPrice())));
				}
				car.setRegisterStatus(dto.getRegisterStatus());// 库存状态
				car.setStatus(dto.getStatus());// 过户状态
				if (i % 2 != 0) {// 样式
					car.setCssFlag(1);
				} else {
					car.setCssFlag(2);
				}
				car.setInsertTimeS(DateUtil.getDateByTimeStamp(dto.getInsertTime()));
				carList.add(car);
				i++;
			}
		}

		setPagingInfo(idao);
		return carList;

	}

	/**
	 * 载入商户所有的车辆
	 * 
	 * @param memberId
	 * @return
	 * @throws TmsDaoException
	 */
	// modify by huangheli 20150815 start
	// public List findAttnCar(String attnId) throws TmsDaoException{
	public List findAttnCar(String attnId, int type) throws TmsDaoException {
		// modify by huangheli 20150815 end
		List<MarketCarInfoDto> memberCarList = new ArrayList<MarketCarInfoDto>();
		int sort = 11;
		if (getSortKey() != 2) {
			sort = getSortKey();
		}
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), sort, isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);
		memberCarList = carDao.findAttnCar(attnId, type);
		List carList = new ArrayList();
		int i = 1;
		if (memberCarList != null && memberCarList.size() > 0) {
			for (MarketCarInfoDto dto : memberCarList) {
				Car car = new Car();
				car.setSerial(dto.getSerial());// 车辆ID
				TransferAcceptedInfo transferAcceptedInfo = TransferAcceptedInfo.getInstance();
				transferAcceptedInfo = transferAcceptedInfo.getTransferBybasicCarId(dto.getSerial());
				if (transferAcceptedInfo != null) {
					car.setTransferSerial(transferAcceptedInfo.getSerial());// 过户流水号
				}
				car.setNum(i);// 序号
				car.setLicensePlate(dto.getLicensePlate());// 车牌号码
				if (StringUtil.isNullOrBlank(dto.getCarName())) {
					car.setCarName("-");
				} else {
					car.setCarName(dto.getCarName());// 车辆名称
				}

				if (dto.getCarScore() == 6) { // 登记楼层
					car.setCarScoreS("场外");
				} else if (dto.getCarScore() == 1) {
					car.setCarScoreS("1层");
				} else if (dto.getCarScore() == 2) {
					car.setCarScoreS("2层");
				} else if (dto.getCarScore() == 3) {
					car.setCarScoreS("3层");
				} else if (dto.getCarScore() == 4) {
					car.setCarScoreS("4层");
				} else if (dto.getCarScore() == 5) {
					car.setCarScoreS("5层");
				} else if (dto.getCarScore() == 7) {
					car.setCarScoreS("楼外");
				}
				car.setIsShelve(dto.getIsShelve());
				// 出入库记录
				MarketCarGateInfo marketCarGateInfo = MarketCarGateInfo.getInstance();
				marketCarGateInfo = marketCarGateInfo.findGateInfoBySerial(dto.getSerial());
				if (StringUtil.isNullOrBlank(DateUtil.getTimeByTimeStamp(marketCarGateInfo.getInsertTime()))) {// 最新进出时间
					car.setInnerTime("-");
				} else {
					car.setInnerTime(DateUtil.getTimeByTimeStamp(marketCarGateInfo.getInsertTime()));
				}

				if (dto.getPrice() == 0) {// 预售价格(元)
					car.setPriceS("-");
				} else {
					car.setPriceS(StringUtil.addDH(Integer.toString(dto.getPrice())));
				}
				car.setRegisterStatus(dto.getRegisterStatus());// 库存状态
				car.setStatus(dto.getStatus());// 过户状态
				if (i % 2 != 0) {// 样式
					car.setCssFlag(1);
				} else {
					car.setCssFlag(2);
				}
				car.setInsertTimeS(DateUtil.getDateByTimeStamp(dto.getInsertTime()));
				carList.add(car);
				i++;
			}
		}

		setPagingInfo(idao);
		return carList;

	}

	/**
	 * 载入商户待办理车辆
	 * 
	 * @param memberId
	 * @return
	 * @throws TmsDaoException
	 */
	public List findMemberCarProxyList(String memberId, int type) throws TmsDaoException {
		List<MarketCarInfoDto> memberCarList = new ArrayList<MarketCarInfoDto>();

		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);
		memberCarList = carDao.findMemberProxyCar(memberId, type);
		List carList = new ArrayList();
		int i = 1;
		if (memberCarList != null && memberCarList.size() > 0) {
			for (MarketCarInfoDto dto : memberCarList) {
				Car car = new Car();
				car.setSerial(dto.getSerial());
				car.setTransferSerial(dto.getTransferSerial());
				car.setNum(i);
				car.setLicensePlate(dto.getLicensePlate());
				car.setCarName(dto.getCarName());
				if (i % 2 != 0) {
					car.setCssFlag(1);
				} else {
					car.setCssFlag(2);
				}
				car.setDisplacement(dto.getDisplacement());
				car.setDisplacementStr(dto.getDisplacementStr());
				if ("".equals(dto.getNewCarOwner()) || dto.getNewCarOwner() == null) {
					car.setNewCarOwner("-");
				} else {
					car.setNewCarOwner(dto.getNewCarOwner());
				}
				if (dto.getAgencyprice() == 0) {
					car.setAgencypriceS("-");
				} else {
					car.setAgencypriceS(String.valueOf(dto.getAgencyprice()));
				}

				car.setAgencytime(dto.getAgencytime());
				if (dto.getExtendedprice() == 0) {
					car.setExtendedpriceS("-");
				} else {
					car.setExtendedpriceS(String.valueOf(dto.getExtendedprice()));
				}
				Codes code = Codes.getInstance();
				car.setStatusTransfer(
						code.getItemValueByItemIdAndItemCode(Codes.ACCEPT_STATUS, dto.getStatusTransfer()));
				carList.add(car);
				i++;
			}
		}

		setPagingInfo(idao);
		return carList;
	}

	/**
	 * 商户过户中list
	 * 
	 * @param memberId
	 * @return
	 * @throws TmsDaoException
	 */
	public List findMemberCarTransferList(String memberId, int type) throws TmsDaoException {
		List<MarketCarInfoDto> memberCarList = new ArrayList<MarketCarInfoDto>();

		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);
		memberCarList = carDao.findMemberCar(memberId, type);
		int i = 1;
		List carList = new ArrayList();
		if (memberCarList != null && memberCarList.size() > 0) {
			for (MarketCarInfoDto dto : memberCarList) {
				Car car = new Car();
				car.setSerial(dto.getSerial());
				car.setLicensePlate(dto.getLicensePlate());
				if (StringUtil.isNullOrBlank(dto.getCarName())) {
					car.setCarName("-");
				} else {
					car.setCarName(dto.getCarName());
				}
				if (i % 2 != 0) {
					car.setCssFlag(1);
				} else {
					car.setCssFlag(2);
				}
				Codes code = Codes.getInstance();
				if (dto.getCarType() == 0) {
					car.setCarTypeS("-");
				} else {
					car.setCarTypeS(code.getItemValueByItemIdAndItemCode(code.VEHICLE_TYPE, dto.getCarType()));
				}

				car.setNum(i);
				if (StringUtil.isNullOrBlank(dto.getDisplacementStr())) {
					car.setDisplacementStr("-");
				} else {
					car.setDisplacementStr(dto.getDisplacementStr());
				}
				car.setInsertTimeS(DateUtil.getDateByTimeStamp(dto.getInsertTime()));

				// 过户表部分
				TransferAcceptedInfo transferAcceptedInfo = TransferAcceptedInfo.getInstance();
				transferAcceptedInfo = transferAcceptedInfo.getTransferBybasicCarId(dto.getSerial());
				if (transferAcceptedInfo != null) {
					car.setTransferSerial(transferAcceptedInfo.getSerial());// 过户流水号
					if (transferAcceptedInfo.getPrice() == 0) {// 交易价格(元)
						car.setPriceS("-");
					} else {
						car.setPriceS(StringUtil.addDH(Integer.toString(transferAcceptedInfo.getPrice())));
					}
					if (transferAcceptedInfo.getTransferPrice() == 0) {
						car.setTransferPrice("-");
					} else {
						car.setTransferPrice(String.valueOf(transferAcceptedInfo.getTransferPrice()));
					}
					if (transferAcceptedInfo.getDoubleTransferPrice() == 0) {
						car.setDoubleTransferPrice("-");
					} else {
						car.setDoubleTransferPrice(String.valueOf(transferAcceptedInfo.getDoubleTransferPrice()));
					}
					car.setStatusTransfer(code.getItemValueByItemIdAndItemCode(Codes.ACCEPT_STATUS,
							transferAcceptedInfo.getStatus()));
				}
				carList.add(car);
				i++;
			}
		}
		setPagingInfo(idao);
		return carList;
	}

	/**
	 * 商户过户中list
	 * 
	 * @param memberId
	 * @return
	 * @throws TmsDaoException
	 */
	public List findAttnCarTransferList(String attnId, int type) throws TmsDaoException {
		List<MarketCarInfoDto> memberCarList = new ArrayList<MarketCarInfoDto>();

		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);
		memberCarList = carDao.findAttnCar(attnId, type);
		int i = 1;
		List carList = new ArrayList();
		if (memberCarList != null && memberCarList.size() > 0) {
			for (MarketCarInfoDto dto : memberCarList) {
				Car car = new Car();
				car.setSerial(dto.getSerial());
				car.setLicensePlate(dto.getLicensePlate());
				if (StringUtil.isNullOrBlank(dto.getCarName())) {
					car.setCarName("-");
				} else {
					car.setCarName(dto.getCarName());
				}
				if (i % 2 != 0) {
					car.setCssFlag(1);
				} else {
					car.setCssFlag(2);
				}
				Codes code = Codes.getInstance();
				if (dto.getCarType() == 0) {
					car.setCarTypeS("-");
				} else {
					car.setCarTypeS(code.getItemValueByItemIdAndItemCode(code.VEHICLE_TYPE, dto.getCarType()));
				}

				car.setNum(i);
				if (StringUtil.isNullOrBlank(dto.getDisplacementStr())) {
					car.setDisplacementStr("-");
				} else {
					car.setDisplacementStr(dto.getDisplacementStr());
				}
				car.setInsertTimeS(DateUtil.getDateByTimeStamp(dto.getInsertTime()));

				// 过户表部分
				TransferAcceptedInfo transferAcceptedInfo = TransferAcceptedInfo.getInstance();
				transferAcceptedInfo = transferAcceptedInfo.getTransferBybasicCarId(dto.getSerial());
				if (transferAcceptedInfo != null) {
					car.setTransferSerial(transferAcceptedInfo.getSerial());// 过户流水号
					if (transferAcceptedInfo.getPrice() == 0) {// 交易价格(元)
						car.setPriceS("-");
					} else {
						car.setPriceS(StringUtil.addDH(Integer.toString(transferAcceptedInfo.getPrice())));
					}
					if (transferAcceptedInfo.getTransferPrice() == 0) {
						car.setTransferPrice("-");
					} else {
						car.setTransferPrice(String.valueOf(transferAcceptedInfo.getTransferPrice()));
					}
					if (transferAcceptedInfo.getDoubleTransferPrice() == 0) {
						car.setDoubleTransferPrice("-");
					} else {
						car.setDoubleTransferPrice(String.valueOf(transferAcceptedInfo.getDoubleTransferPrice()));
					}
					car.setStatusTransfer(code.getItemValueByItemIdAndItemCode(Codes.ACCEPT_STATUS,
							transferAcceptedInfo.getStatus()));
				}
				carList.add(car);
				i++;
			}
		}
		setPagingInfo(idao);
		return carList;
	}

	/**
	 * 载入商户车辆数量
	 * 
	 * @param memberId
	 * @param status
	 * @return
	 * @throws TmsDaoException
	 */
	public int loadMemberCarCount(String memberId, int type) throws TmsDaoException {
		int count = 0;
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		count = carDao.loadMemberCarCount(memberId, type);
		return count;
	}

	/**
	 * 载入经办人车辆数量
	 * 
	 * @param attnId
	 * @param type
	 * @return
	 * @throws TmsDaoException
	 */
	public int loadAttnCarCount(String attnId, int type) throws TmsDaoException {
		int count = 0;
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		count = carDao.loadAttnCarCount(attnId, type);
		return count;
	}

	/**
	 * 代办理列表
	 * 
	 * @return
	 * @throws TmsDaoException
	 * @throws ParseException
	 * @throws UnsupportedEncodingException
	 */
	public List<ControlCarDto> loadInnerCarList() throws TmsDaoException, ParseException, UnsupportedEncodingException {

		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);
		// 取代办理list
		List<ControlCarDto> innerCarList = carDao.loadControlCarList();

		setPagingInfo(idao);
		return innerCarList;
	}

	/**
	 * dto向entity赋值
	 * 
	 * @param controlCarDto
	 * @throws ParseException
	 * @throws TmsDaoException
	 * @throws UnsupportedEncodingException
	 */
	private Car setEntityFromDto(ControlCarDto controlCarDto, int k, int pageNO)
			throws ParseException, TmsDaoException, UnsupportedEncodingException {
		Member member = Member.getInstance();
		Car car = Car.getInstance();

		car.setCarLicense(controlCarDto.getCarLicense());
		String img = "image/" + controlCarDto.getImgPath();

		car.setImgPath(img);
		car.setmName(member.getMemNameByMemId(controlCarDto.getmId()));
		car.setInputTime(StringUtil.getCurrDateTimeNotSec(controlCarDto.getInputTime()));
		car.setAcceptTime(StringUtil.getCurrDateTimeNotSec(controlCarDto.getAcceptTime()));
		car.setId(controlCarDto.getId());
		k = k + (pageNO - 1) * 10;
		car.setNum(k);
		return car;

	}

	/**
	 * 根据VIN码查询车辆信息
	 * 
	 * @return
	 */
	public Car findCarByVin(String vin) throws TmsDaoException {
		Car car = Car.getInstance();
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		// 根据VIN码查询车辆信息
		MarketCarInfoDto marketCarInfoDto = (MarketCarInfoDto) carDao.findCarByVin(vin);
		if (marketCarInfoDto != null)
			car.setEntityFromDto(marketCarInfoDto);
		return car;
	}

	
	/**
	 * 根据vin码到base表中查询车辆信息
	 * 
	 * @throws TmsDaoException
	 * 
	 */
	public Car findCarBaseInfoByVin(String vin) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		// 根据VIN码查询车辆信息
		BaseCarInfoDto baseCarInfoDto = (BaseCarInfoDto) carDao.findCarBaseInfoByVin(vin);
		if (baseCarInfoDto != null) {
			Car car = new Car();
			car.setEntityFromBaseDto(baseCarInfoDto);
			return car;
		}
		return null;
	}

	/**
	 * 向entity赋值
	 * 
	 * @param marketCarInfoDto
	 */
	private void setEntityFromBaseDto(BaseCarInfoDto baseCarInfoDto) {
		this.setBrandId(baseCarInfoDto.getBrandId());
		this.setCarStyleId(baseCarInfoDto.getCarStyleId());
		this.setCardType(baseCarInfoDto.getCardType());
		this.setLicensePlate(baseCarInfoDto.getLicensePlate());
		this.setCarOwner(baseCarInfoDto.getCarOwner());
		this.setCarOwnerIdCardNo(baseCarInfoDto.getCarOwnerIdCardNo());
		this.setCarType(baseCarInfoDto.getCarType());
		this.setCarUse(baseCarInfoDto.getCarUse());
		this.setColor(baseCarInfoDto.getColor());
		this.setCountryStyle(baseCarInfoDto.getCountryStyle());
		this.setDisplacement(baseCarInfoDto.getDisplacement());
		this.setEngine(baseCarInfoDto.getEngine());
		this.setFuelType(baseCarInfoDto.getFuelType());
		this.setGearbox(baseCarInfoDto.getGearbox());
		this.setJqx(baseCarInfoDto.getJqx());
		this.setLoadquality(baseCarInfoDto.getLoadquality());
		this.setModelCode(baseCarInfoDto.getModelCode());
		this.setOwnerAddress(baseCarInfoDto.getOwnerAddress());
		this.setOwnerOrgNo(baseCarInfoDto.getOwnerOrgNo());
		this.setOwnerPhone(baseCarInfoDto.getOwnerPhone());
		this.setOwnerType(baseCarInfoDto.getOwnerType());
		this.setPassenger(baseCarInfoDto.getPassenger());
		this.setRegDate(baseCarInfoDto.getRegDate());
		this.setRegisterCardNo(baseCarInfoDto.getRegisterCardNo());
		this.setSendCardDate(baseCarInfoDto.getSendCardDate());
		this.setVendorCode(baseCarInfoDto.getVendorCode());
		this.setVin(baseCarInfoDto.getVin());
		this.setYearCarefulPeriod(baseCarInfoDto.getYearCarefulPeriod());
		this.setVendorId(baseCarInfoDto.getVendorId());
	}

	/**
	 * 根据车辆流水号查询车辆信息
	 * 
	 * @param serial
	 * @return
	 * @throws TmsDaoException
	 */
	public Car findCarBySerial(String serial) throws TmsDaoException {
		Car car = Car.getInstance();
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		// 根据流水号查询出车辆的信息
		MarketCarInfoDto marketCarInfoDto = carDao.findCarBySerial(serial);
		if (marketCarInfoDto != null) {
			car.setEntityFromDto(marketCarInfoDto);
		}
		return car;
	}

	/**
	 * @param id
	 *            唯一识别号
	 * @param type
	 *            类型
	 * @return
	 * @throws TmsDaoException
	 */
	public Car findCarById(String id, PlateNumberTypes type) throws TmsDaoException {
		Car car = Car.getInstance();
		MarketCarInfoDto dto = null;
		CarDao dao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		if (type == PlateNumberTypes.PLATE_NUMBER) dto = dao.findCarByLicensePlateInventory(id);
		else if (type == PlateNumberTypes.TEMP_PLATE_NUMBER) dto = dao.findCarByTempLicensePlate(id, 0);
		// 库存状态: 无记录 /过期/存档
		boolean isNull = dto == null;
		if (dto!=null) car.setEntityFromDto(dto);
		return isNull ? null : car;
	}

	public Car findCarByNewLicensePlate(String newlicensePlate) throws TmsDaoException {
		Car car = Car.getInstance();
		CarDao dao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = dao.findCarByNewLicensePlate(newlicensePlate);
		boolean isNull = dto == null;
		if (!isNull) car.setEntityFromDto(dto);
		return isNull ? null : car;
	}

	public Car findPrivilegeCarByTempLicensePlate(String templicensePlate, int type) throws TmsDaoException {
		Car car = Car.getInstance();
		CarDao dao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = dao.findPrivilegeCarByLicensePlate(templicensePlate, type);
		boolean isNull = dto == null;
		if (!isNull) car.setEntityFromDto(dto);
		return isNull ? null : car;
	}

	//
	public Car findCarByTempLicensePlate(String templicensePlate) throws TmsDaoException {
		return findCarByTempLicensePlate(templicensePlate, 0);
	}

	public Car findCarByTempLicensePlate(String templicensePlate, int beginIndex) throws TmsDaoException {
		Car car = Car.getInstance();
		CarDao dao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = dao.findCarByTempLicensePlate(templicensePlate, beginIndex);
		boolean isNull = dto == null;
		if (!isNull) car.setEntityFromDto(dto);
		return isNull ? null : car;
	}

	public List<MarketCarInfoDto> findCarList(String condition, int type) throws TmsDaoException {
		CarDao dao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return dao.findCarList(condition, type);
	}

	// add by mufeiyu start

	public String vinCheck(String vin) throws TmsDaoException {
		CarDao dao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return dao.vinCheck(vin);
	}

	public String vinCheckNotKeep(String vin) throws TmsDaoException {
		CarDao dao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return dao.vinCheckNotKeep(vin);
	}

	public List<MarketCarInfoDto> findCarListNotKeep(String condition, int type) throws TmsDaoException {
		CarDao dao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return dao.findCarListNotKeep(condition, type);
	}

	public List<MarketCarInfoDto> findCarListIsCancel(String condition, int type) throws TmsDaoException {
		CarDao dao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return dao.findCarListIsCancel(condition, type);
	}
	// add by mufeiyu e n d

	/**
	 * 添加车辆信息
	 * 
	 * @throws TmsDaoException
	 */
	public void insertCar(Car car, List<CarImage> list, String sysPath, String serial, int type)
			throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto marketCarInfoDto = new MarketCarInfoDto();
		// 从car向dto赋值
		marketCarInfoDto = setDtoFromEntity(marketCarInfoDto, car);

		int flg = carDao.findSameSerial(serial);
		if (flg == 2) {

		}
		marketCarInfoDto.setSerial(serial);

		sysPath = sysPath.replace("/tmsweb", "");

		// 对文件名进行处理
		// List<CarImage> 图片的list 传到daoimp层进行迭代添加到tms_pic表中

		File outFile = null;
		File inFile = null;
		if (list != null) {
			for (int i = 0; i < list.size(); i++) {
				CarImage imgEntity = (CarImage) list.get(i);

				// 对每个path进行处理
				inFile = new File(sysPath + imgEntity.getImgPath());

				outFile = new File(
						sysPath + Registry.getConfig(TmsConstants.UPLOAD_CONTEXT_ROOT_KEY) + "/" + serial + "/");
				if (!outFile.exists()) {
					outFile.mkdirs();
				}
				outFile = new File(outFile + "/" + serial + "_" + imgEntity.getImgKey() + ".jpg");

				boolean result = CopyFile.copy(inFile, outFile);
				if (result) {
					// imgDto = new CarImgDto();
					if ("1".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_1(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("2".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_2(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("3".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_3(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("4".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_4(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("5".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_5(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("6".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_6(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("7".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_7(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("8".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_8(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}

				}

				// dtoList.add(imgDto);
			}
		}
		if (type == 1) {// 操作员
			// 保存车辆信息
			carDao.saveMarketCarInfo(marketCarInfoDto);
		} else {// 会员
			carDao.saveMemberMarketCarInfo(marketCarInfoDto);
		}

		// 进行图片保存
		// CarImageDao imagDao =
		// (CarImageDao)TmsDao.getInstance(TmsDao.TMS_PIC);
		// imagDao.insertCarImageInfo(dtoList);

		// 对待入库车辆的状态进行修改
		if (car.getInnerType() == 2) {
			// 把在待入库的车辆的状态设置为1（处理完了）
			car.cancelInnerCar(car.getId());
		}
	}

	/**
	 * 处理存入数据库中的图片路径
	 */
	private String imgPath(String path, String serial, String imgKey) {
		String imageRootPath = "";

		return imageRootPath + Registry.getConfig(TmsConstants.UPLOAD_CONTEXT_ROOT_KEY) + "/" + serial + "/" + serial
				+ "_" + imgKey + ".jpg";
	}

	/**
	 * 车辆信息修改
	 * 
	 * @param car
	 * @throws TmsDaoException
	 */
	public void updateCar(Car car, List<CarImage> list, String sysPath) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto marketCarInfoDto = new MarketCarInfoDto();
		// 从car向dto赋值
		marketCarInfoDto = setDtoFromEntity(marketCarInfoDto, car);
		// 车辆的流水号
		String serial = car.getSerial();

		sysPath = sysPath.replace("/tmsweb", "");

		// 对文件名进行处理
		// List<CarImage> 图片的list 传到daoimp层进行迭代添加到tms_pic表中
		List<CarImgDto> dtoList = new ArrayList<CarImgDto>();
		File outFile = null;
		File inFile = null;

		if (list != null) {
			for (int i = 0; i < list.size(); i++) {
				CarImage imgEntity = (CarImage) list.get(i);
				// 对每个path进行处理
				inFile = new File(sysPath + imgEntity.getImgPath());
				outFile = new File(
						sysPath + Registry.getConfig(TmsConstants.UPLOAD_CONTEXT_ROOT_KEY) + "/" + serial + "/");
				if (!outFile.exists()) {
					outFile.mkdirs();
				}
				if (imgEntity.getImgPath().indexOf("carImageTmp") != -1) {
					outFile = new File(outFile + "/" + serial + "_" + imgEntity.getImgKey() + ".jpg");
					CopyFile.copy(inFile, outFile);

					if ("1".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_1(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("2".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_2(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("3".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_3(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("4".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_4(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("5".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_5(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("6".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_6(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("7".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_7(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}
					if ("8".equals(imgEntity.getImgKey())) {
						marketCarInfoDto.setPhoto_8(imgPath(imgEntity.getImgPath(), serial, imgEntity.getImgKey()));
					}

				}
			}
		}
		carDao.updateMarketCarInfo(marketCarInfoDto);

	}

	/**
	 * 修改车辆信息
	 * 
	 * @throws TmsDaoException
	 */
	public void updateMarketCarInfo(Car entity) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto marketCarInfoDto = new MarketCarInfoDto();
		// 从car向dto赋值
		marketCarInfoDto = setDtoFromEntity(marketCarInfoDto, entity);
		carDao.updateMarketCarInfo(marketCarInfoDto);
	}

	public void updateMarketCarPhoto(Car entity) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto marketCarInfoDto = new MarketCarInfoDto();
		// 从car向dto赋值
		marketCarInfoDto = setDtoFromEntity(marketCarInfoDto, entity);
		carDao.updateCarPic(marketCarInfoDto);
	}

	/**
	 * 根据车牌号码查询车辆信息
	 * 
	 * @param licensePlate
	 * @return
	 * @throws TmsDaoException
	 */
	public Car searchCarByLicensePlate(String licensePlate) throws TmsDaoException {
		Car car = Car.getInstance();
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);

		// 查出车辆信息
		MarketCarInfoDto marketCarInfoDto = (MarketCarInfoDto) carDao.findCarByLicensePlate(licensePlate);
		if (marketCarInfoDto != null)
			car.setEntityFromDto(marketCarInfoDto);
		return car;
	}

	/**
	 * 根据车牌号码查询所有库存车辆信息
	 * 
	 * @param licensePlate
	 * @return
	 * @throws TmsDaoException
	 */
	public Car searchAllCarByLicensePlate(String licensePlate) throws TmsDaoException {
		Car car = Car.getInstance();
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);

		// 查出车辆信息
		MarketCarInfoDto marketCarInfoDto = (MarketCarInfoDto) carDao.searchAllCarByLicensePlate(licensePlate);
		if (marketCarInfoDto != null) {
			car.setEntityFromDto(marketCarInfoDto);
		} else {
			return null;
		}

		return car;
	}

	/**
	 * 根据车辆监控id载入车辆信息
	 * 
	 * @return
	 */
	public Car findCarById(long id) throws TmsDaoException {
		Car car = Car.getInstance();
		ControlCarDto controlCarDto = new ControlCarDto();
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		// 查出车辆的信息
		controlCarDto = (ControlCarDto) carDao.findCarById(id);
		car.setEntityFromControlCarDto(controlCarDto);
		return car;
	}

	/**
	 * 信息修改判断更新时间
	 * 
	 * @param id
	 * @param uTime
	 * @return
	 */
	public int findUtimeStatus(int id, String uTime) throws TmsDaoException {
		int flg = 1;
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		flg = carDao.findUtimeStatus(id, uTime);
		return flg;
	}

	/**
	 * 监控表复制给entity
	 * 
	 * @param controlCarDto
	 */
	private void setEntityFromControlCarDto(ControlCarDto controlCarDto) {
		this.id = controlCarDto.getId();
		this.acceptTime = controlCarDto.getAcceptTime();
		this.imgPath = controlCarDto.getImgPath();
		this.carLicense = controlCarDto.getCarLicense();
		this.inputTime = controlCarDto.getInputTime();
		this.acceptStatus = controlCarDto.getAcceptStatus();
		this.mId = controlCarDto.getmId();
	}

	/**
	 * 监控表复制给entity
	 * 
	 * @param controlCarDto
	 */
	private void setEntityFromCarDto(ControlCarDto controlCarDto) {
		this.registerStatus = controlCarDto.getRegisterStatus();
		this.memberId = controlCarDto.getmId();
	}

	/**
	 * 向entity赋值
	 * 
	 * @param marketCarInfoDto
	 * @throws TmsDaoException
	 */
	private void setEntityFromDto(MarketCarInfoDto marketCarInfoDto) {
		this.setSerial(marketCarInfoDto.getSerial());
		this.setTempLicensePlate(marketCarInfoDto.getTempLicensePlate());
		this.setStorageTime(marketCarInfoDto.getStorageTime());
		this.setEnterTime(marketCarInfoDto.getEnterTime());
		this.setcId(marketCarInfoDto.getId());
		this.setAttribute(marketCarInfoDto.getAttribute());
		this.setBrandId(marketCarInfoDto.getBrandId());
		this.setCarStyleId(marketCarInfoDto.getCarStyleId());
		this.setCardType(marketCarInfoDto.getCardType());
		this.setLicensePlate(marketCarInfoDto.getLicensePlate());
		this.setCarOwner(marketCarInfoDto.getCarOwner());
		this.setCarOwnerIdCardNo(marketCarInfoDto.getCarOwnerIdCardNo());
		this.setCarType(marketCarInfoDto.getCarType());
		this.setCarUse(marketCarInfoDto.getCarUse());
		this.setColor(marketCarInfoDto.getColor());
		this.setCompanyContactPerson(marketCarInfoDto.getCompanyContactPerson());
		this.setCompanyContactPhone(marketCarInfoDto.getCompanyContactPhone());
		this.setCountryStyle(marketCarInfoDto.getCountryStyle());
		this.setDisplacement(marketCarInfoDto.getDisplacement());
		this.setEngine(marketCarInfoDto.getEngine());
		this.setFuelType(marketCarInfoDto.getFuelType());
		this.setGearbox(marketCarInfoDto.getGearbox());
		this.setJqx(marketCarInfoDto.getJqx());
		this.setLoadquality(marketCarInfoDto.getLoadquality());
		this.setMemberId(marketCarInfoDto.getMemberId());
		this.setMileage(marketCarInfoDto.getMileage());
		this.setModelCode(marketCarInfoDto.getModelCode());
		this.setOwnerAddress(marketCarInfoDto.getOwnerAddress());
		this.setOwnerOrgNo(marketCarInfoDto.getOwnerOrgNo());
		this.setOwnerPhone(marketCarInfoDto.getOwnerPhone());
		this.setOwnerType(marketCarInfoDto.getOwnerType());
		this.setPassenger(marketCarInfoDto.getPassenger());
		this.setPrice(marketCarInfoDto.getPrice());
		this.setRegDate(marketCarInfoDto.getRegDate());
		this.setRegisterCardNo(marketCarInfoDto.getRegisterCardNo());
		this.setSendCardDate(marketCarInfoDto.getSendCardDate());
		this.setSerial(marketCarInfoDto.getSerial());
		this.setUpdateTime(marketCarInfoDto.getUpdateTime());
		this.setUpdateUserId(marketCarInfoDto.getUpdateUserId());
		this.setVendorCode(marketCarInfoDto.getVendorCode());
		this.setVin(marketCarInfoDto.getVin());
		this.setYearCarefulPeriod(marketCarInfoDto.getYearCarefulPeriod());
		this.setPhoto_1(marketCarInfoDto.getPhoto_1());
		this.setPhoto_2(marketCarInfoDto.getPhoto_2());
		this.setPhoto_3(marketCarInfoDto.getPhoto_3());
		this.setPhoto_4(marketCarInfoDto.getPhoto_4());
		this.setPhoto_5(marketCarInfoDto.getPhoto_5());
		this.setPhoto_6(marketCarInfoDto.getPhoto_6());
		this.setPhoto_7(marketCarInfoDto.getPhoto_7());
		this.setPhoto_8(marketCarInfoDto.getPhoto_8());
		this.setRegisterStatus(marketCarInfoDto.getRegisterStatus());
		this.setEntryStatus(marketCarInfoDto.getEntryStatus());
		this.setVendorId(marketCarInfoDto.getVendorId());
		this.setImagePath(marketCarInfoDto.getImagePath());
		this.setStatus(marketCarInfoDto.getStatus());
		this.setCarScore(marketCarInfoDto.getCarScore());
		this.setInsertTime(marketCarInfoDto.getInsertTime());
		this.setInsertUserId(marketCarInfoDto.getInsertUserId());
		this.setAttestStatus(marketCarInfoDto.getAttestStatus());
		this.setCarName(marketCarInfoDto.getCarName());
		this.setBarCodeNum(marketCarInfoDto.getBarCodeNum());
		this.setRemark(marketCarInfoDto.getRemark());
		this.setIsShelve(marketCarInfoDto.getIsShelve());
		this.setTempLicensePlate(marketCarInfoDto.getTempLicensePlate());
		this.setLicensePlate(marketCarInfoDto.getLicensePlate());
		this.setVin(marketCarInfoDto.getVin());
		this.setIsMatch(marketCarInfoDto.getIsMatch());
		this.setNewLicensePlate(marketCarInfoDto.getNewLicensePlate());
		this.setCatClass(marketCarInfoDto.getCatClass());
		if (marketCarInfoDto.getTmpEnterTime() != null)
			this.setTmpEnterTime(marketCarInfoDto.getTmpEnterTime());
		if (marketCarInfoDto.getTmpStorageTime() != null)
			this.setTmpStorageTime(marketCarInfoDto.getTmpStorageTime());
		if (marketCarInfoDto.getChgLicensePlateTime() != null)
			this.setChgLicensePlateTimes(StringUtil.getTimeByTimeStamp(marketCarInfoDto.getChgLicensePlateTime()));
		if (marketCarInfoDto.getEnterTime() != null)
			this.setEnterTimes(StringUtil.getTimeByTimeStamp(marketCarInfoDto.getEnterTime()));
		if (marketCarInfoDto.getStorageTime() != null)
			this.setStorageTimes(StringUtil.getTimeByTimeStamp(marketCarInfoDto.getStorageTime()));
		if (marketCarInfoDto.getInsertTime() != null)
			this.setInsertTimeS(StringUtil.getTimeByTimeStamp(marketCarInfoDto.getInsertTime()));
		this.setConfigKey(marketCarInfoDto.getConfigKey());
		this.setAttestStatus(marketCarInfoDto.getAttestStatus());
		this.setIsShelve(marketCarInfoDto.getIsShelve());
		this.setEnterTime(marketCarInfoDto.getEnterTime());
	}

	/**
	 * 从Entity向dto赋值
	 * 
	 * @param marketCarInfoDto
	 * @param car
	 * @return
	 */
	private MarketCarInfoDto setDtoFromEntity(MarketCarInfoDto marketCarInfoDto, Car car) {
		marketCarInfoDto.setRemark(car.getRemark());
		marketCarInfoDto.setId((int) car.getId());
		marketCarInfoDto.setAttribute(car.getAttribute());
		marketCarInfoDto.setBrandId(car.getBrandId());
		marketCarInfoDto.setCardType(car.getCardType());
		marketCarInfoDto.setLicensePlate(car.getLicensePlate());
		marketCarInfoDto.setCarOwner(car.getCarOwner());
		marketCarInfoDto.setCarOwnerIdCardNo(car.getCarOwnerIdCardNo());
		marketCarInfoDto.setCarType(car.getCarType());
		marketCarInfoDto.setCarUse(car.getCarUse());
		marketCarInfoDto.setColor(car.getColor());
		marketCarInfoDto.setCompanyContactPerson(car.getCompanyContactPerson());
		marketCarInfoDto.setCompanyContactPhone(car.getCompanyContactPhone());
		marketCarInfoDto.setCountryStyle(car.getCountryStyle());
		marketCarInfoDto.setDisplacement(car.getDisplacement());
		marketCarInfoDto.setEngine(car.getEngine());
		marketCarInfoDto.setFuelType(car.getFuelType());
		marketCarInfoDto.setGearbox(car.getGearbox());
		marketCarInfoDto.setJqx(car.getJqx());
		marketCarInfoDto.setLoadquality(car.getLoadquality());
		marketCarInfoDto.setMemberId(car.getMemberId());
		marketCarInfoDto.setMileage(car.getMileage());
		marketCarInfoDto.setModelCode(car.getModelCode());
		marketCarInfoDto.setOwnerAddress(car.getOwnerAddress());
		marketCarInfoDto.setOwnerOrgNo(car.getOwnerOrgNo());
		marketCarInfoDto.setOwnerPhone(car.getOwnerPhone());
		marketCarInfoDto.setOwnerType(car.getOwnerType());
		marketCarInfoDto.setPassenger(car.getPassenger());
		marketCarInfoDto.setPrice(car.getPrice());
		marketCarInfoDto.setRegDate(car.getRegDate());
		marketCarInfoDto.setRegisterCardNo(car.getRegisterCardNo());
		marketCarInfoDto.setSendCardDate(car.getSendCardDate());
		marketCarInfoDto.setSerial(car.getSerial());
		marketCarInfoDto.setUpdateTime(car.getUpdateTime());
		marketCarInfoDto.setUpdateUserId(car.getUpdateUserId());
		marketCarInfoDto.setVendorCode(car.getVendorCode());
		marketCarInfoDto.setVin(car.getVin());
		marketCarInfoDto.setYearCarefulPeriod(car.getYearCarefulPeriod());
		marketCarInfoDto.setUpdateUserId(car.getUpdateUserId());
		marketCarInfoDto.setCarStyleId(car.getCarStyleId());
		marketCarInfoDto.setVendorId(car.getVendorId());
		marketCarInfoDto.setCarName(car.getCarName());
		marketCarInfoDto.setCarScore(car.getCarScore());
		marketCarInfoDto.setEntryStatus(car.getEntryStatus());
		marketCarInfoDto.setRegisterStatus(car.getRegisterStatus());
		marketCarInfoDto.setInsertUserId(car.getInsertUserId());
		marketCarInfoDto.setPhoto_1(car.getPhoto_1());
		marketCarInfoDto.setPhoto_2(car.getPhoto_2());
		marketCarInfoDto.setPhoto_3(car.getPhoto_3());
		marketCarInfoDto.setPhoto_4(car.getPhoto_4());
		marketCarInfoDto.setPhoto_5(car.getPhoto_5());
		marketCarInfoDto.setPhoto_6(car.getPhoto_6());
		marketCarInfoDto.setPhoto_7(car.getPhoto_7());
		marketCarInfoDto.setPhoto_8(car.getPhoto_8());
		marketCarInfoDto.setUpBsflag(car.getUpBsflag());
		marketCarInfoDto.setStatus(car.getStatus());
		marketCarInfoDto.setColor(car.getColor());
		marketCarInfoDto.setBarCodeNum(car.getBarCodeNum());
		marketCarInfoDto.setTempLicensePlate(car.getTempLicensePlate());
		marketCarInfoDto.setRemark(car.getRemark());
		marketCarInfoDto.setCatClass(car.getCatClass());
		marketCarInfoDto.setIsMatch(car.getIsMatch());
		marketCarInfoDto.setConfigKey(car.getConfigKey());
		marketCarInfoDto.setInsertTimeUpadateFlg(car.isInsertTimeUpadateFlg());
		marketCarInfoDto.setAttestStatus(car.getAttestStatus());
		marketCarInfoDto.setInternalScore(car.getInternalScore());
		marketCarInfoDto.setExternalScore(car.getExternalScore());
		marketCarInfoDto.setDetectRemark(car.getDetectRemark());
		marketCarInfoDto.setIsShelve(car.getIsShelve());
		if (car.getInsertTime() != null) {
			Timestamp tempTime = new Timestamp(car.getInsertTime().getTime());
			marketCarInfoDto.setInsertTime(tempTime);
			marketCarInfoDto.setUpdateTime(tempTime);
		}
		return marketCarInfoDto;
	}

	/**
	 * 高级搜索
	 * 
	 * 参数：车辆ID 车辆品牌ID 车系ID 车牌号 vin码 会员ID 入场开始时间 入场结束时间， 库存状态，楼层，认证状态
	 * 
	 * @return
	 * @throws TmsDaoException
	 */
	@SuppressWarnings("unchecked")
	public List findSeniorSearchResult(String carClass, String vendorId, String brandId, String licensePlant,
			String vin, String memId, String startTime, String endTime, String registerStatus, String barCodeNum,
			String tempLicensePlate, String minPrice, String maxPrice, String startYear, String endYear)
			throws TmsDaoException {

		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);
		List list = carDao.findSeniorSearchResultByCon(carClass, vendorId, brandId, licensePlant, vin, memId, startTime,
				endTime, registerStatus, barCodeNum, tempLicensePlate, minPrice, maxPrice, startYear, endYear);
		Codes code = Codes.getInstance();
		if (list.size() > 0) {
			for (int i = 0; i < list.size(); i++) {
				MarketCarInfoDto dto = (MarketCarInfoDto) list.get(i);
				dto.setRegisterStatusInfo(
						code.getItemValueByItemIdAndItemCode(Codes.REGISTERSTATUS_TYPE, dto.getRegisterStatus()));
				dto.setBarCodeNumInfo(code.getItemValueByItemIdAndItemCode(Codes.BARCODENUM_TYPE, dto.getBarCodeNum()));
			}
		}
		setPagingInfo(idao);
		return list;
	}

	/**
	 * 载入特殊车辆列表
	 * 
	 * @param startTime
	 * @param endTime
	 * @return
	 * @throws TmsDaoException
	 */
	public List findSpecialCar(String startTime, String endTime, int type, int carRidio) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);
		List list = carDao.findImCarName(startTime, endTime, type, carRidio);
		MarketCarInfoDto carDto = new MarketCarInfoDto();
		List list1 = new ArrayList();
		for (int i = 0; i < list.size(); i++) {
			carDto = (MarketCarInfoDto) list.get(i);
			if (i % 2 == 0) {
				carDto.setCssFlag(1);
			} else {
				carDto.setCssFlag(2);
			}
			TransferAcceptedInfo transferAcceptedInfo = new TransferAcceptedInfo();
			transferAcceptedInfo = transferAcceptedInfo.getTransferBybasicCarId(carDto.getSerial());
			if (type != 3) {
				carDto.setTransferSerial(transferAcceptedInfo.getSerial());
			}

			if (type == 2) {
				carDto.setMarketType("库存");
			} else if (type == 1) {
				carDto.setMarketType("非库存");
			} else if (type == 3) {
				carDto.setMarketType("老数据");
			}
			carDto.setModelName(carDto.getVendorCode() + "-" + carDto.getModelCode());
			Codes code = Codes.getInstance();
			carDto.setTransferStatus(
					code.getItemValueByItemIdAndItemCode(Codes.ACCEPT_STATUS, transferAcceptedInfo.getStatus()));
			carDto.setInsertTimeS(DateUtil.getDateByTimeStamp(carDto.getInsertTime()));
			list1.add(carDto);
		}

		setPagingInfo(idao);
		return list1;
	}

	public List findAllSpecialCar(String startTime, String endTime, int type, int carRidio) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		List list = carDao.findAllImCarName(startTime, endTime, type, carRidio);
		return list;
	}

	/**
	 * 高级搜索 - 进出库查询
	 * 
	 * @param serial
	 * @param licensePlate
	 * @param memId
	 * @param startTime
	 * @param endTime
	 * @param carScore
	 * @param registerStatus
	 * @param attestStatus
	 * @return
	 * @throws TmsDaoException
	 */
	public List findInoutResult(String serial, String threadStatus, String gateId, String startTime, String endTime)
			throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);
		List<MarketCarGateInfoDto> list = carDao.findInoutResult(serial, threadStatus, gateId, startTime, endTime);
		List<MarketCarGateInfoDto> result = new ArrayList<MarketCarGateInfoDto>();
		Codes code = Codes.getInstance();
		for (MarketCarGateInfoDto dto : list) {
			if (!StringUtil.isNullOrBlank(dto.getCarPhoto())) {
				// fix bug20170209
				dto.setCarPhoto(dto.getCarPhoto());
				// String remotePath =
				// Registry.getConfig(TmsConstants.GATE_PIC_SERVER_KEY)+"\\" +
				// dto.getCarPhoto();
				// String photoUrl =
				// MD5Util.getMD5String(CopyFile.getFileNameNoEx(remotePath))+"."+CopyFile.getExtensionName(remotePath);
				// dto.setCarPhoto(Registry.getConfig(TmsConstants.GATE_PIC_URL_KEY)
				// + photoUrl);
				dto.setCarBodyColor(code.getItemValueByItemIdAndItemCode(Codes.VEHICLE_COLOR, dto.getCarColor()));
				dto.setCarLicenseColor(
						code.getItemValueByItemIdAndItemCode(Codes.LICENSECOLOR_TYPE, dto.getLicenseColor()));
				dto.setThreadTypeInfo(code.getItemValueByItemIdAndItemCode(Codes.THREADTYPE_TYPE, dto.getThreadType()));
				dto.setThreadStatusInfo(
						code.getItemValueByItemIdAndItemCode(Codes.THREADSTATUS_TYPE, dto.getThreadStatus()));
			}
			result.add(dto);
		}
		setPagingInfo(idao);
		return result;
	}

	/**
	 * 取消处理
	 * 
	 * @param licensePlate
	 * @throws TmsDaoException
	 */
	public void cancelInnerCar(long id) throws TmsDaoException {

		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.cancelInnerCar(id);
	}

	/**
	 * 
	 * 根据查询条件查询车辆进出库信息
	 * 
	 * @return
	 * @throws TmsDaoException
	 */
	public List findGatesInfoIOList(String cardNo, String carLicense, String period) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);

		// 按天算 需要格式化一下进行比较
		/****** 时间处理部分开始 *******************************************************************/
		int yy = Integer.parseInt(new SimpleDateFormat("yyyy").format(Calendar.getInstance().getTime()));// 年
		int mm = Integer.parseInt(new SimpleDateFormat("MM").format(Calendar.getInstance().getTime()));// 月
		int dd = Integer.parseInt(new SimpleDateFormat("dd").format(Calendar.getInstance().getTime()));// 月
		/********** 时间处理部分结束 ***************************************************************/

		if (period != null && !"".equals(period)) {
			if (period.equals("1")) {
				if (mm == 1) {
					// 上一年
					period = (yy - 1) + "-12-" + dd;
				} else {
					// 月份直接减1
					period = yy + "-" + (mm - 1) + "-" + dd;
				}
			}
			if (period.equals("2")) {
				if (mm <= 3) {
					// 上一年
					period = (yy - 1) + "-" + (12 - (3 - mm)) + "-" + dd;
				} else {
					period = yy + "-" + (mm - 3) + "-" + dd;
				}
			}
			if (period.equals("3")) {
				if (mm <= 6) {
					period = (yy - 1) + "-" + (12 - (6 - mm)) + "-" + dd;
				} else {
					period = yy + "-" + (mm - 6) + "-" + dd;
				}
			}
		}

		List list = carDao.findGatesInfoIOList(cardNo, carLicense, period);

		setPagingInfo(idao);
		return list;
	}

	/**
	 * 
	 * 库存统计下探页面 商户入库信息一览 参数（会员ID memID）
	 * 
	 * @param memId
	 * @return
	 * @throws TmsDaoException
	 */
	public List<MarketCarInfoDto> getCarStockCountInfoByMemId(String memId) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());

		List<MarketCarInfoDto> list = carDao.getCarStockCountInfoByMemId(memId);

		return list;
	}

	/**
	 * 
	 * 车辆图片车辆一览list数据获取
	 * 
	 * 一天之内(受理时间)
	 * 
	 * @return
	 * @throws TmsDaoException
	 */
	public List<MarketCarInfoDto> getCarPhoneInfoList() throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);

		List<MarketCarInfoDto> list = carDao.getCarPhoneInfoList();

		setPagingInfo(idao);
		return list;
	}

	/**
	 * 根据车牌号码判断车辆是否存在
	 * 
	 * @throws TmsDaoException
	 * 
	 */
	public boolean isExistInMarketCarInfoBylicensePlate(String licensePlate) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		boolean isExist = false;
		if (!StringUtil.isNullOrBlank(licensePlate)) {

			isExist = carDao.findInsertCarFlag(licensePlate);
			return isExist;
		}
		return isExist;
	}

	/**
	 * 根据车辆编号判断车辆是否存在
	 * 
	 * @throws TmsDaoException
	 * 
	 */
	public boolean isExistInMarketCarInfoBySerial(String serial) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		boolean isExist = false;
		if (!StringUtil.isNullOrBlank(serial)) {

			isExist = carDao.findCarbySerial(serial);
			return isExist;
		}
		return isExist;
	}

	public void updateLicenseplateBySerial(String licensePlate, String tmpLicenseplate, String serial)
			throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);

		carDao.updateLicenseplateBySerial(licensePlate, tmpLicenseplate, serial);
	}

	/**
	 * 评估更新库存信息
	 * 
	 * @return
	 * @throws TmsDaoException
	 */
	public void updateCarInfoAtAssess(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);

		MarketCarInfoDto dto = new MarketCarInfoDto();

		dto = setDtoFromEntity(dto, car);

		carDao.updateCarInfoAtAssess(dto);
	}

	/**
	 * 查验更新库存信息
	 */
	public void updateCarInfoAtCheck(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);

		MarketCarInfoDto dto = new MarketCarInfoDto();

		dto.setSerial(car.getSerial());
		dto.setOwnerType(car.getOwnerType());
		dto.setUpdateUserId(car.getUpdateUserId());
		dto.setStatus(car.getStatus());
		carDao.updateCarInfoAtCheck(dto);
	}

	/**
	 * 待办受理更新库存信息
	 * 
	 * @return
	 * @throws TmsDaoException
	 */
	public void updateMarketInfoByLicensePlate(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);

		MarketCarInfoDto dto = new MarketCarInfoDto();

		dto = setDtoFromEntity(dto, car);

		carDao.updateMarketInfoByLicensePlate(dto);

	}

	/**
	 * PAD上传
	 * 
	 * @return
	 * @throws TmsDaoException
	 */
	public void updateCarAtPad(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();

		dto = setDtoFromEntity(dto, car);

		carDao.updateCarAtPad(dto);
	}

	public void updateCarEvaluate(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto = setDtoFromEntity(dto, car);
		carDao.updateCarEvaluate(dto.getSerial(), dto);
	}

	public void updateCarPic(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto = setDtoFromEntity(dto, car);
		carDao.updateCarPhotoBySerial(dto.getSerial(), dto);
	}

	/**
	 * 插入一条车辆信息(pad库存同步)
	 * 
	 * @return
	 */
	public void insertCarInfo(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();

		dto = setDtoFromEntity(dto, car);

		carDao.insertCarInfo(dto);
	}

	/**
	 * 插入一条车辆信息(WeiChat库存同步)
	 * 
	 * @return
	 */
	public void insertCarInfoWhthWeiChat(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();

		Integer carId = carDao.findCarIdbySerial(car.getSerial());
		dto = setDtoFromEntity(dto, car);
		if (carId == null) {
			carDao.insertCarInfoWithWeiChat(dto);
		} else {
			carDao.updateMarketCarInfo(dto);
		}

	}

	/**
	 * 立体停车场入库
	 * 
	 * @param car
	 * @throws TmsDaoException
	 */
	public void insertEasyCarInfo(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto = setDtoFromEntity(dto, car);
		carDao.insertEasyCarInfo(dto);
	}

	/**
	 * 个人向库存插数据
	 * 
	 * @return
	 * @throws TmsDaoException
	 */
	public void insertPersonalCarInfo(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto = setDtoFromEntity(dto, car);
		carDao.insertPersonalCarInfo(dto);
	}

	/**
	 * 入库登记入库确认
	 * 
	 * @param serial
	 * @param carScore
	 * @throws TmsDaoException
	 *             type=1入库 type=2 出库
	 */
	public void updateRegisterStatus(Car car, int type) throws TmsDaoException {

		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto.setSerial(car.getSerial());
		carDao.updateRegisterStatus(dto, type);
	}

	public void updateCarStatus(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto.setStatus(car.getStatus());
		dto.setRegisterStatus(car.getRegisterStatus());
		dto.setSerial(car.getSerial());
		dto.setUpdateUserId(car.getUpdateUserId());
		carDao.updateCarStatus(dto);
	}

	public void updateCarLicensePlateInfo(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto.setSerial(car.getSerial());
		dto.setNewLicensePlate(car.getNewLicensePlate());
		dto.setLicensePlate(car.getLicensePlate());
		dto.setUpdateUserId(car.getUpdateUserId());
		carDao.updateCarLicensePlateInfo(dto);
	}

	public Car findMarketCarInfoListByVin(String vin) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = carDao.findMarketCarInfoListByVin(vin);
		Car car = new Car();
		if (dto != null) {
			car.setSerial(dto.getSerial());
			car.setLicensePlate(dto.getLicensePlate());
			car.setMemberId(dto.getMemberId());
		}
		return car;
	}

	public void updateCarStatusOnly(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto.setStatus(car.getStatus());
		dto.setSerial(car.getSerial());
		dto.setUpdateUserId(car.getUpdateUserId());
		carDao.updateCarStatusOnly(dto);
	}

	public void updateCarStatusByLicenseplate(int status, String Licenseplate) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		carDao.updateCarStatusByLicenseplate(status, Licenseplate);
	}

	/**
	 * add by huangwei
	 * 
	 * @param serial
	 * @param registerStatus
	 * @param updateUserId
	 * @throws TmsDaoException
	 */
	public void updateCarRegisterStatus(String serial, int registerStatus, int updateUserId) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateCarInfoForInventory(serial, registerStatus, updateUserId);
	}

	/**
	 * @param serial
	 * @throws TmsDaoException
	 */
	public void updateChargeStartDateBySerial(String serial, Timestamp chargeStartDate) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateChargeStartDateBySerial(serial, chargeStartDate);
	}

	public void updateCarBarCodeNum(String serial, int barCodeNum) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateCarInfoForBarCodeNum(serial, barCodeNum);
	}

	/**
	 * 更新库存状态
	 * 
	 * @param car
	 * @return
	 * @throws TmsDaoException
	 */
	public void updateCarRegisterStatus(String serial, int registerStatus) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateRegisterStatus(serial, registerStatus);
	}

	/**
	 * 插入库存车辆特殊处理数据
	 * 
	 * @param car
	 * @return
	 * @throws TmsDaoException
	 */
	public void insertCarHandleInfo(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarHandleInfoDto dto = new MarketCarHandleInfoDto();
		dto.setSerial(car.getSerial());
		dto.setUpdateUserId(car.getUpdateUserId());
		dto.setHandleType(car.getHandleType());
		dto.setIsPush(car.getIsPush());
		dto.setUpdateTime(new Timestamp(car.getUpdateTime().getTime()));
		dto.setPushContent(car.getPushContent());
		dto.setAcceptorImage(car.getAcceptorImage());
		dto.setRemark(car.getRemark());
		carDao.insertCarHandleInfo(dto);
	}

	/**
	 * 统计车辆数量 （目前库存，在库）
	 * 
	 * @param type
	 * @return
	 * @throws TmsDaoException
	 */
	public int findCarCount(int type) throws TmsDaoException {
		int count = 0;
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		count = carDao.findCarCount(type);
		return count;
	}

	/**
	 * 根据会员id统计车辆数量 （目前库存，在库）
	 * 
	 * @return
	 */
	public int findCarCountByMem(int type, String memId) throws TmsDaoException {
		int count = 0;
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		count = carDao.findCarCountByMem(type, memId);
		return count;
	}

	/**
	 * pad库存车辆同步，查看是否有相同车牌号码存在，并且入库状态不为3,4
	 * 
	 * @param licensePlate
	 * @return
	 * @throws TmsDaoException
	 */
	public Car findCarForPad(String licensePlate) throws TmsDaoException {
		Car car = Car.getInstance();
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto = carDao.findCarForPad(licensePlate);
		car.setSerial(dto.getSerial());

		car.setEntityFromDto(dto);
		return car;
	}

	/**
	 * 更新库存数据（简单入库）
	 * 
	 * @param serial
	 * @throws TmsDaoException
	 */
	public void updateCarEasy(Car car) throws TmsDaoException {
		Car newCar = Car.getInstance();
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto = setDtoFromEntity(dto, car);
		carDao.updateCarEasy(dto);
	}

	public void insertBaseCarInfo(BaseCarInfoDto entity) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.insertBaseCarInfo(entity);
	}

	public void updateBaseCarInfo(BaseCarInfoDto entity) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateBaseCarInfo(entity);
	}

	public void updateCarOwnerByOwnerCardNo(MarketCarInfoDto dto) throws TmsDaoException{
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateCarOwnerByOwnerCardNo(dto);
	}
	
	public void insertCarOwner(MarketCarInfoDto dto) throws TmsDaoException{
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.insertCarOwner(dto);
	}
	
	public MarketCarInfoDto getCarOwnerById(String id) throws TmsDaoException{
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return carDao.getCarOwnerById(id);
	}
	
	public List<MarketCarInfoDto> findCarOwnerByCardNo(String ownerCardNo) throws TmsDaoException{
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return carDao.findCarOwnerByCardNo(ownerCardNo);
	}
	
	public List<MarketCarInfoDto> findCarOwnerByName(String name) throws TmsDaoException{
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return carDao.findCarOwnerByName(name);
	}
	
	public List<MarketCarInfoDto> findCarListByVin(String vin) throws TmsDaoException{
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return carDao.findCarListByVin(vin);
	}
	
	public void updateCarByVin(String vin, String regDate) throws TmsDaoException{
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateCarByVin(vin, regDate);
	}
	/**
	 * 更新会员ID
	 * 
	 * @return
	 * @throws TmsDaoException
	 */
	public void updateMemberIdBySerial(Car entity) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto.setMemberId(entity.getMemberId());
		// #111
		dto.setCompanyContactPerson(entity.getCompanyContactPerson());
		dto.setCompanyContactPhone(entity.getCompanyContactPhone());
		dto.setSerial(entity.getSerial());
		carDao.updateMemberIdBySerial(dto);
	}

	public void updateLicenseBySerial(Car entity) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto.setUpdateUserId(entity.getUpdateUserId());
		dto.setLicensePlate(entity.getLicensePlate());
		dto.setSerial(entity.getSerial());
		carDao.updateLicenseBySerial(dto);
	}

	public void updateNewLicenseBySerial(TransferPersonalCarInfoDto entity) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		TransferPersonalCarInfoDto dto = new TransferPersonalCarInfoDto();
		dto.setUpdateUserId(entity.getUpdateUserId());
		dto.setNewLicensePlate(entity.getNewLicensePlate());
		dto.setSerial(entity.getSerial());
		carDao.updateNewLicenseBySerial(dto);
	}

	public void updateNewLicenseBySerial(Car entity) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto.setUpdateUserId(entity.getUpdateUserId());
		dto.setNewLicensePlate(entity.getNewLicensePlate());
		dto.setSerial(entity.getSerial());
		carDao.updateNewLicenseBySerial(dto);
	}

	public void deleteCarInfoBySerial(String serial) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.deleteCarInfoBySerial(serial);
	}

	public void updateCarNameS(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto.setSerial(car.getSerial());
		dto.setGearbox(car.getGearbox());
		dto.setDisplacement(car.getDisplacement());
		dto.setVendorId(car.getVendorId());
		dto.setBrandId(car.getBrandId());
		dto.setCarStyleId(car.getCarStyleId());
		dto.setCarName(car.getCarName());
		dto.setUpdateUserId(car.getUpdateUserId());
		carDao.updateCarName(dto);
	}

	// add by huangheli at 20150803 start
	/**
	 * 根据车辆流水号和车牌号码查询车辆信息
	 * 
	 * @param serial
	 * @param licensePlate
	 * @return serial
	 * @throws TmsDaoException
	 */
	public Car findCarBySerialLicensePlate(String serial, String licensePlate) throws TmsDaoException {
		Car car = Car.getInstance();
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		// 根据流水号查询出车辆的信息
		MarketCarInfoDto marketCarInfoDto = carDao.findCarBySerialLicensePlate(serial, licensePlate);
		if (marketCarInfoDto != null) {
			car.setEntityFromDto(marketCarInfoDto);
		}
		return car;
	}

	/**
	 * 
	 * 挂起/解挂专用
	 * 
	 * @param serial
	 * @param carScore
	 * @throws TmsDaoException
	 *             type=5：挂起 6：登记
	 */
	public void updatePendingliftStatus(Car car, int type) throws TmsDaoException {

		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();

		dto.setUpdateUserId(car.getUpdateUserId());
		dto.setSerial(car.getSerial());
		carDao.updatePendingliftStatus(dto, type);
	}

	// add by huangheli at 20150803 end
	public List findCarListInfo(Car car, int type) throws TmsDaoException {

		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		List<MarketCarInfoDto> dtoList = new ArrayList<MarketCarInfoDto>();

		MarketCarInfoDto dtoInfo = new MarketCarInfoDto();
		dtoInfo.setSerial(car.getSerial());
		dtoInfo.setLicensePlate(car.getLicensePlate());
		dtoInfo.setVin(car.getVin());
		dtoList = carDao.findCarListInfo(dtoInfo, type);

		List list = new ArrayList();
		int i = 1;
		if (dtoList != null && dtoList.size() > 0) {
			for (MarketCarInfoDto dto : dtoList) {
				Car carInfo = new Car();
				if (i % 2 == 0) {
					carInfo.setCssFlag(2);
				} else {
					carInfo.setCssFlag(1);
				}
				carInfo.setNum(i);// 序号
				carInfo.setSerial(dto.getSerial());// 车辆编号
				carInfo.setLicensePlate(dto.getLicensePlate());// 车牌号码
				carInfo.setVin(dto.getVin());// 车架号
				carInfo.setPhoto_1(dto.getPhoto_1());// 车辆照片
				if (dto.getInsertTime() != null) {
					carInfo.setInsertTimeS(DateUtil.getTimeByTimeStamp1(dto.getInsertTime()));// 登记时间
				}
				if (dto.getIsValid() == 2) {
					carInfo.setCheckImgPath(dto.getCheckImgPath());// 查验单照片
					carInfo.setCheckUserName(dto.getCheckUserName());// 查验员
					carInfo.setCheckTime(DateUtil.getTimeByTimeStamp1(dto.getCheckTime()));// 查验时间
				} else {
					carInfo.setCheckImgPath("");
					carInfo.setCheckUserName("");
					carInfo.setCheckTime("");
				}
				// 缴费状况
				if (dto.getCheckPrice() == 0) {
					carInfo.setCheckPriceStatus("未缴费");
				} else {
					carInfo.setCheckPriceStatus("已缴费");
				}
				i++;
				list.add(carInfo);
			}
		}
		return list;
	}

	/**
	 * 更新进出时间
	 * 
	 * @param car
	 * @throws TmsDaoException
	 */
	public void updateTmpStorageEnterTime(Car car) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto.setSerial(car.getSerial());
		dto.setTmpStorageTime(car.getTmpStorageTime());
		dto.setTmpEnterTime(car.getTmpEnterTime());
		carDao.updateTmpStorageEnterTime(dto);
	}

	public PageResultDto findPageCarByMemberId(String memberId, int pageNumber, int pageSize) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		PageResultDto dto = new PageResultDto();
		dto.setPageNumber(pageNumber);
		dto.setPageSize(pageSize);
		dto.setRecordCount(carDao.getCarByMemberIdCount(memberId));
		dto.setResult(carDao.findPageCarByMemberId(memberId, pageNumber, pageSize));
		return dto;
	}

	public PageResultDto findPageCarByCarStyleId(String carStyleId, int pageNumber, int pageSize)
			throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		PageResultDto dto = new PageResultDto();
		dto.setPageNumber(pageNumber);
		dto.setPageSize(pageSize);
		dto.setRecordCount(carDao.getMarketCarInfoCountByCarStyleId(carStyleId));
		dto.setResult(carDao.getMarketCarInfoByCarStyleId(carStyleId, pageNumber, pageSize));
		return dto;
	}

	public PageResultDto findMarketCarPrice(double minPrice, double maxPrice, int pageNumber, int pageSize)
			throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		PageResultDto dto = new PageResultDto();
		dto.setPageNumber(pageNumber);
		dto.setPageSize(pageSize);
		dto.setRecordCount(carDao.getMarketCarPriceCount(minPrice, maxPrice));
		dto.setResult(carDao.getMarketCarPrice(minPrice, maxPrice, pageNumber, pageSize));
		return dto;
	}

	public MarketCarInfoChe300 getCarInfobySerial(String serial) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return carDao.getCarInfobySerial(serial);
	}

	public TroubleCarInfoDto getTroubleCarInfobyVin(String vin) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return carDao.getTroubleCarInfobyVin(vin);
	}

	public void insertTroubleCarInfo(TroubleCarInfoDto dto) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.insertTroubleCarInfo(dto);
	}

	public void updateTroubleCarInfo(TroubleCarInfoDto dto) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateTroubleCarInfo(dto);
	}

	public void deleteTroubleCarInfo(TroubleCarInfoDto dto) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.deleteTroubleCarInfo(dto);
	}

	public String getCarLicense() {
		return carLicense;
	}

	public void setCarLicense(String carLicense) {
		this.carLicense = carLicense;
	}

	public long getmId() {
		return mId;
	}

	public void setmId(long mId) {
		this.mId = mId;
	}

	public String getImgPath() {
		return imgPath;
	}

	public void setImgPath(String imgPath) {
		this.imgPath = imgPath;
	}

	public Date getInputTime() {
		return inputTime;
	}

	public void setInputTime(Date inputTime) {
		this.inputTime = inputTime;
	}

	public Date getAcceptTime() {
		return acceptTime;
	}

	public void setAcceptTime(Date acceptTime) {
		this.acceptTime = acceptTime;
	}

	public String getVin() {
		return vin;
	}

	public void setVin(String vin) {
		this.vin = vin;
	}

	public String getSerial() {
		return serial;
	}

	public void setSerial(String serial) {
		this.serial = serial;
	}

	public String getCarOwner() {
		return carOwner;
	}

	public void setCarOwner(String carOwner) {
		this.carOwner = carOwner;
	}

	public String getEngine() {
		return engine;
	}

	public void setEngine(String engine) {
		this.engine = engine;
	}

	public String getLicensePlate() {
		return licensePlate;
	}

	public void setLicensePlate(String licensePlate) {
		this.licensePlate = licensePlate;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public int getColor() {
		return color;
	}

	public void setColor(int color) {
		this.color = color;
	}

	public String getVendorCode() {
		return vendorCode;
	}

	public void setVendorCode(String vendorCode) {
		this.vendorCode = vendorCode;
	}

	public String getModelCode() {
		return modelCode;
	}

	public void setModelCode(String modelCode) {
		this.modelCode = modelCode;
	}

	public int getDisplacement() {
		return displacement;
	}

	public void setDisplacement(int displacement) {
		this.displacement = displacement;
	}

	public int getGearbox() {
		return gearbox;
	}

	public void setGearbox(int gearbox) {
		this.gearbox = gearbox;
	}

	public int getCarUse() {
		return carUse;
	}

	public void setCarUse(int carUse) {
		this.carUse = carUse;
	}

	public int getCarType() {
		return carType;
	}

	public void setCarType(int carType) {
		this.carType = carType;
	}

	public String getRegDate() {
		return regDate;
	}

	public void setRegDate(String regDate) {
		this.regDate = regDate;
	}

	public String getNewLicensePlate() {
		return newLicensePlate;
	}

	public void setNewLicensePlate(String newLicensePlate) {
		this.newLicensePlate = newLicensePlate;
	}

	public String getJqx() {
		return jqx;
	}

	public void setJqx(String jqx) {
		this.jqx = jqx;
	}

	public String getYearCarefulPeriod() {
		return yearCarefulPeriod;
	}

	public void setYearCarefulPeriod(String yearCarefulPeriod) {
		this.yearCarefulPeriod = yearCarefulPeriod;
	}

	public int getMileage() {
		return mileage;
	}

	public void setMileage(int mileage) {
		this.mileage = mileage;
	}

	public String getSendCardDate() {
		return sendCardDate;
	}

	public void setSendCardDate(String sendCardDate) {
		this.sendCardDate = sendCardDate;
	}

	public int getCardType() {
		return cardType;
	}

	public void setCardType(int cardType) {
		this.cardType = cardType;
	}

	public String getRegisterCardNo() {
		return registerCardNo;
	}

	public void setRegisterCardNo(String registerCardNo) {
		this.registerCardNo = registerCardNo;
	}

	public int getCountryStyle() {
		return countryStyle;
	}

	public void setCountryStyle(int countryStyle) {
		this.countryStyle = countryStyle;
	}

	public int getFuelType() {
		return fuelType;
	}

	public void setFuelType(int fuelType) {
		this.fuelType = fuelType;
	}

	public String getCompanyContactPerson() {
		return companyContactPerson;
	}

	public void setCompanyContactPerson(String companyContactPerson) {
		this.companyContactPerson = companyContactPerson;
	}

	public String getCompanyContactPhone() {
		return companyContactPhone;
	}

	public void setCompanyContactPhone(String companyContactPhone) {
		this.companyContactPhone = companyContactPhone;
	}

	public String getCarOwnerIdCardNo() {
		return carOwnerIdCardNo;
	}

	public void setCarOwnerIdCardNo(String carOwnerIdCardNo) {
		this.carOwnerIdCardNo = carOwnerIdCardNo;
	}

	public String getBrandId() {
		return brandId;
	}

	public void setBrandId(String brandId) {
		this.brandId = brandId;
	}

	public int getMemberId() {
		return memberId;
	}

	public void setMemberId(int memberId) {
		this.memberId = memberId;
	}

	public int getLoadquality() {
		return loadquality;
	}

	public void setLoadquality(int loadquality) {
		this.loadquality = loadquality;
	}

	public int getPassenger() {
		return passenger;
	}

	public void setPassenger(int passenger) {
		this.passenger = passenger;
	}

	public int getOwnerType() {
		return ownerType;
	}

	public void setOwnerType(int ownerType) {
		this.ownerType = ownerType;
	}

	public String getOwnerCardNo() {
		return ownerCardNo;
	}

	public void setOwnerCardNo(String ownerCardNo) {
		this.ownerCardNo = ownerCardNo;
	}

	public String getOwnerPhone() {
		return ownerPhone;
	}

	public void setOwnerPhone(String ownerPhone) {
		this.ownerPhone = ownerPhone;
	}

	public String getOwnerAddress() {
		return ownerAddress;
	}

	public void setOwnerAddress(String ownerAddress) {
		this.ownerAddress = ownerAddress;
	}

	public String getOwnerOrgNo() {
		return ownerOrgNo;
	}

	public void setOwnerOrgNo(String ownerOrgNo) {
		this.ownerOrgNo = ownerOrgNo;
	}

	public int getAttribute() {
		return attribute;
	}

	public void setAttribute(int attribute) {
		this.attribute = attribute;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public int getUpdateUserId() {
		return updateUserId;
	}

	public void setUpdateUserId(int updateUserId) {
		this.updateUserId = updateUserId;
	}

	public Date getEnterTime() {
		return enterTime;
	}

	public void setEnterTime(Date enterTime) {
		this.enterTime = enterTime;
	}

	public String getStartTime() {
		return startTime;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public int getAcceptStatus() {
		return acceptStatus;
	}

	public void setAcceptStatus(int acceptStatus) {
		this.acceptStatus = acceptStatus;
	}

	public String getCarStyleId() {
		return carStyleId;
	}

	public void setCarStyleId(String carStyleId) {
		this.carStyleId = carStyleId;
	}

	public int getInnerType() {
		return innerType;
	}

	public void setInnerType(int innerType) {
		this.innerType = innerType;
	}

	public String getmName() {
		return mName;
	}

	public void setmName(String mName) {
		this.mName = mName;
	}

	public int getCssFlag() {
		return cssFlag;
	}

	public void setCssFlag(int cssFlag) {
		this.cssFlag = cssFlag;
	}

	public int getcId() {
		return cId;
	}

	public void setcId(int cId) {
		this.cId = cId;
	}

	public int getNum() {
		return num;
	}

	public void setNum(int num) {
		this.num = num;
	}

	public String getVendorId() {
		return vendorId;
	}

	public void setVendorId(String vendorId) {
		this.vendorId = vendorId;
	}

	public String getCarName() {
		return carName;
	}

	public void setCarName(String carName) {
		this.carName = carName;
	}

	public String getPhoto_1() {
		return photo_1;
	}

	public void setPhoto_1(String photo_1) {
		this.photo_1 = photo_1;
	}

	public String getPhoto_2() {
		return photo_2;
	}

	public void setPhoto_2(String photo_2) {
		this.photo_2 = photo_2;
	}

	public String getPhoto_3() {
		return photo_3;
	}

	public void setPhoto_3(String photo_3) {
		this.photo_3 = photo_3;
	}

	public String getPhoto_4() {
		return photo_4;
	}

	public void setPhoto_4(String photo_4) {
		this.photo_4 = photo_4;
	}

	public String getPhoto_5() {
		return photo_5;
	}

	public void setPhoto_5(String photo_5) {
		this.photo_5 = photo_5;
	}

	public String getPhoto_6() {
		return photo_6;
	}

	public void setPhoto_6(String photo_6) {
		this.photo_6 = photo_6;
	}

	public String getPhoto_7() {
		return photo_7;
	}

	public void setPhoto_7(String photo_7) {
		this.photo_7 = photo_7;
	}

	public String getPhoto_8() {
		return photo_8;
	}

	public void setPhoto_8(String photo_8) {
		this.photo_8 = photo_8;
	}

	public Date getStorageTime() {
		return storageTime;
	}

	public void setStorageTime(Date storageTime) {
		this.storageTime = storageTime;
	}

	public Date getInsertTime() {
		return insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	public int getCarScore() {
		return carScore;
	}

	public void setCarScore(int carScore) {
		this.carScore = carScore;
	}

	public int getRegisterStatus() {
		return registerStatus;
	}

	public void setRegisterStatus(int registerStatus) {
		this.registerStatus = registerStatus;
	}

	public int getEntryStatus() {
		return entryStatus;
	}

	public void setEntryStatus(int entryStatus) {
		this.entryStatus = entryStatus;
	}

	public int getInsertUserId() {
		return insertUserId;
	}

	public void setInsertUserId(int insertUserId) {
		this.insertUserId = insertUserId;
	}

	public int getUpBsflag() {
		return upBsflag;
	}

	public void setUpBsflag(int upBsflag) {
		this.upBsflag = upBsflag;
	}

	public String getImagePath() {
		return imagePath;
	}

	public void setImagePath(String imagePath) {
		this.imagePath = imagePath;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getPriceS() {
		return priceS;
	}

	public void setPriceS(String priceS) {
		this.priceS = priceS;
	}

	public String getMileageS() {
		return mileageS;
	}

	public void setMileageS(String mileageS) {
		this.mileageS = mileageS;
	}

	public String getNewCarOwner() {
		return newCarOwner;
	}

	public void setNewCarOwner(String newCarOwner) {
		this.newCarOwner = newCarOwner;
	}

	public int getAgencyprice() {
		return agencyprice;
	}

	public void setAgencyprice(int agencyprice) {
		this.agencyprice = agencyprice;
	}

	public int getExtendedprice() {
		return extendedprice;
	}

	public void setExtendedprice(int extendedprice) {
		this.extendedprice = extendedprice;
	}

	public Date getAgencytime() {
		return agencytime;
	}

	public void setAgencytime(Date agencytime) {
		this.agencytime = agencytime;
	}

	public String getStatusTransfer() {
		return statusTransfer;
	}

	public void setStatusTransfer(String statusTransfer) {
		this.statusTransfer = statusTransfer;
	}

	public String getDisplacementStr() {
		return displacementStr;
	}

	public void setDisplacementStr(String displacementStr) {
		this.displacementStr = displacementStr;
	}

	public String getExtendedpriceS() {
		return extendedpriceS;
	}

	public void setExtendedpriceS(String extendedpriceS) {
		this.extendedpriceS = extendedpriceS;
	}

	public String getStorageTimeS() {
		return StorageTimeS;
	}

	public void setStorageTimeS(String storageTimeS) {
		StorageTimeS = storageTimeS;
	}

	public String getTempLicensePlate() {
		return tempLicensePlate;
	}

	public void setTempLicensePlate(String tempLicensePlate) {
		this.tempLicensePlate = tempLicensePlate;
	}

	public int getAttestStatus() {
		return attestStatus;
	}

	public void setAttestStatus(int attestStatus) {
		this.attestStatus = attestStatus;
	}

	public String getTransferSerial() {
		return transferSerial;
	}

	public void setTransferSerial(String transferSerial) {
		this.transferSerial = transferSerial;
	}

	public String getCarScoreS() {
		return carScoreS;
	}

	public void setCarScoreS(String carScoreS) {
		this.carScoreS = carScoreS;
	}

	public String getInnerTime() {
		return innerTime;
	}

	public void setInnerTime(String innerTime) {
		this.innerTime = innerTime;
	}

	public String getInsertTimeS() {
		return insertTimeS;
	}

	public void setInsertTimeS(String insertTimeS) {
		this.insertTimeS = insertTimeS;
	}

	public String getCarTypeS() {
		return carTypeS;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public void setCarTypeS(String carTypeS) {
		this.carTypeS = carTypeS;
	}

	public String getTransferPrice() {
		return transferPrice;
	}

	public void setTransferPrice(String transferPrice) {
		this.transferPrice = transferPrice;
	}

	public String getDoubleTransferPrice() {
		return doubleTransferPrice;
	}

	public void setDoubleTransferPrice(String doubleTransferPrice) {
		this.doubleTransferPrice = doubleTransferPrice;
	}

	public String getAgencypriceS() {
		return agencypriceS;
	}

	public void setAgencypriceS(String agencypriceS) {
		this.agencypriceS = agencypriceS;
	}

	public int getBarCodeNum() {
		return barCodeNum;
	}

	public void setBarCodeNum(int barCodeNum) {
		this.barCodeNum = barCodeNum;
	}

	public int getIsShelve() {
		return isShelve;
	}

	public void setIsShelve(int isShelve) {
		this.isShelve = isShelve;
	}

	public void setHandleType(int handleType) {
		this.handleType = handleType;
	}

	public int getHandleType() {
		return handleType;
	}

	public void setIsPush(int isPush) {
		this.isPush = isPush;
	}

	public int getIsPush() {
		return isPush;
	}

	public void setPushContent(String pushContent) {
		this.pushContent = pushContent;
	}

	public String getPushContent() {
		return pushContent;
	}

	/**
	 * 根据新车牌号码判断车辆是否存在
	 */
	public MarketCarInfoDto isExistInMarketCarInfoByNewLicensePlate(String newLicensePlate) throws TmsDaoException {
		if (StringUtil.isNullOrBlank(newLicensePlate))
			return null;
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return carDao.findCarFlagByNewLicensePlate(newLicensePlate);
	}

	public void updateRegisterStatus(String serial, int registerStatus, int updateUserId) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateRegisterStatus(serial, registerStatus, updateUserId);
	}

	public String findBrandNameById(String id) throws TmsDaoException {
		VehicleBrandDao dao = (VehicleBrandDao) TmsDao.getInstance(TmsDao.TMS_VEHICLE_BRNAD);
		String vendorId = dao.findBrandNameById(id);
		return vendorId;
	}

	public TransferAcceptedInfoDto findTransfeAcceptedInfo(String licensePlate) throws TmsDaoException {
		TransferAcceptedInfoDao uDao = (TransferAcceptedInfoDao) TmsDao.getInstance(TmsDao.TMS_TRANSFER_ACCEPTED_INFO);
		return uDao.findTransfeAcceptedInfo(licensePlate);
	}

	public void updateTransfeAcceptedInfo(String serial, int marketType, String basicCarId, int updateUserId)
			throws TmsDaoException {
		TransferAcceptedInfoDao uDao = (TransferAcceptedInfoDao) TmsDao.getInstance(TmsDao.TMS_TRANSFER_ACCEPTED_INFO);
		uDao.updateTransfeAcceptedInfo(serial, marketType, basicCarId, updateUserId);
	}

	public void updateMarketCarInfo(String serial, int status, int updateUserId) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateMarketCarInfo(serial, status, updateUserId);
	}

	// 返回车辆过户状态
	public int getTransferPersonalCarInfo(String serial) throws TmsDaoException {
		TransferPersonalCarInfoDao dao = (TransferPersonalCarInfoDao) TmsDao
				.getInstance(TmsDao.TMS_TRANSFER_PERSONALCAR_INFO);
		return dao.getTransferPersonalCarInfo(serial);
	}

	public void updateTransferPersonalCarInfo(String serial, int status, int updateUserId) throws TmsDaoException {
		TransferPersonalCarInfoDao uDao = (TransferPersonalCarInfoDao) TmsDao
				.getInstance(TmsDao.TMS_TRANSFER_PERSONALCAR_INFO);
		TransferPersonalCarInfoDto dto = new TransferPersonalCarInfoDto();
		dto.setSerial(serial);
		dto.setStatus(status);
		dto.setUpdateUserId(updateUserId);
		uDao.updateCarStatus(dto);
	}

	public void updateTempLicensePlate(String licensePlate, int isUse) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateTmpLicensePlate(licensePlate, isUse);
	}

	public void insertTransferProcessHistory(TransferProcessHistoryDto dto) throws TmsDaoException {
		TransferProcessHistoryDao uDao = (TransferProcessHistoryDao) TmsDao
				.getInstance(TmsDao.TMS_TRANSFER_PROCESS_HISTORY);
		uDao.insertHisInfoAtAssess(dto);
	}

	public void insertTransferFinanceInfo(TransferFinanceInfoDto dto) throws TmsDaoException {
		TransferFinanceInfoDao uDao = (TransferFinanceInfoDao) TmsDao.getInstance(TmsDao.TMS_TRANSFER_FINANCE_INFO);
		uDao.insertTransferFinanceInfo(dto);
	}

	public void insertPadHistory(PicChangeHistoryDto dto) throws TmsDaoException {
		TransferProcessHistoryDao uDao = (TransferProcessHistoryDao) TmsDao
				.getInstance(TmsDao.TMS_TRANSFER_PROCESS_HISTORY);
		uDao.insertPicChangeHistory(dto);
	}

	public List<MarketCarInfoDto> getMarCarInfo(String memberId, String vin) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		return carDao.getMarCarInfo(memberId, vin);
	}
	
	public List<MarketCarInfoDto> getCarInfo(String memId, String carScore) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		List<MarketCarInfoDto> list = carDao.getCarInfo(memId, carScore);
		return list;
	}
	
	public List<MarketCarInfoDto> getVaoNameInfoList(String py) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		return carDao.getVaoNameInfoList(py);
	}
	
	
	public MarketCarInfoDto getCtiyInfo(String cityId) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		return carDao.getCtiyInfo(cityId);
	}

	public List<MarketCarGateInfoDto> findInoutResult(String serial) throws TmsDaoException {
		final List<MarketCarGateInfoDto> result = new ArrayList<MarketCarGateInfoDto>();
		final CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(),
				isAsc());
		final ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);
		final List<MarketCarGateInfoDto> list = carDao.findInoutResult(serial);
		for (MarketCarGateInfoDto dto : list) {
			if (!StringUtil.isNullOrBlank(dto.getCarPhoto())) {
				dto.setCarPhoto(dto.getCarPhoto());
				// fix bug20170209
				// String remotePath =
				// Registry.getConfig(TmsConstants.GATE_PIC_SERVER_KEY)+"\\" +
				// dto.getCarPhoto();
				// String photoUrl =
				// MD5Util.getMD5String(CopyFile.getFileNameNoEx(remotePath))+"."+CopyFile.getExtensionName(remotePath);
				// dto.setCarPhoto(Registry.getConfig(TmsConstants.GATE_PIC_URL_KEY)
				// + photoUrl);
			}
			result.add(dto);
		}
		setPagingInfo(idao);
		return result;
	}

	/**
	 * 判断输入的车架号是否已经被登记过
	 * 
	 * @param vin
	 * @return
	 * @throws TmsDaoException
	 */
	public boolean isExistMarketCarByVin(String vin) throws TmsDaoException {
		Car car = Car.getInstance();
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);

		// 根据输入的车架号查询出车辆的信息
		boolean isExistFlg = carDao.isExistMarketCarByVin(vin);

		return isExistFlg;
	}

	/**
	 * 判断库存状态是否变化
	 * 
	 * @param serial
	 * @param registerStatus
	 * @return
	 * @throws TmsDaoException
	 */
	public boolean isChangedStockStatus(String serial, int registerStatus) throws TmsDaoException {

		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);

		// 根据车辆编号查询出车辆库存状态
		boolean isChangedFlg = carDao.isChangedStockStatus(serial, registerStatus);

		return isChangedFlg;
	}

	/**
	 * 商户ID取得
	 * 
	 * @param serial
	 * @return
	 * @throws TmsDaoException
	 */
	public Car findMemberId(String serial) throws TmsDaoException {
		Car car = Car.getInstance();
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		ControlCarDto controlCarDto = new ControlCarDto();
		// 查出车辆的信息
		controlCarDto = (ControlCarDto) carDao.findMemberId(serial);
		car.setEntityFromCarDto(controlCarDto);

		return car;
	}

	/**
	 * 已用登记数量取得
	 * 
	 * @param memberId
	 * @return
	 * @throws TmsDaoException
	 */
	public int getAlreadyTransactionVolumeByMemberId(String memberId) throws TmsDaoException {
		int number = 0;
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		// 查出车辆的信息
		number = carDao.getAlreadyTransactionVolumeByMemberId(memberId);
		return number;
	}

	/**
	 * 车牌号取得
	 * 
	 * @param licensePlate
	 * @return
	 * @throws TmsDaoException
	 */
	public List<Car> findLicensePlateListByRegisterStatus(String licensePlate) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		List<MarketCarInfoDto> dtoList = carDao.findLicensePlateListByRegisterStatus(licensePlate);
		List<Car> list = new ArrayList<Car>();
		for (MarketCarInfoDto dto : dtoList) {
			Car car = new Car();
			car.setcId(dto.getId());
			car.setLicensePlate(dto.getLicensePlate());
			list.add(car);
		}
		return list;
	}

	
	/**
	 * 车牌号取得
	 * 
	 * @param licensePlate
	 * @return
	 * @throws TmsDaoException
	 */
	public List<Car> findLicensePlateList(String licensePlate) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		List<MarketCarInfoDto> dtoList = carDao.findLicensePlateList(licensePlate);
		List<Car> list = new ArrayList<Car>();
		for (MarketCarInfoDto dto : dtoList) {
			Car car = new Car();
			car.setcId(dto.getId());
			car.setLicensePlate(dto.getLicensePlate());
			list.add(car);
		}
		return list;
	}
	
	/**
	 * 车架号取得
	 * 
	 * @param vin
	 * @return
	 * @throws TmsDaoException
	 */
	public List<Car> findVinList(String vin) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		List<MarketCarInfoDto> dtoList = carDao.findVinList(vin);
		List<Car> list = new ArrayList<Car>();
		for (MarketCarInfoDto dto : dtoList) {
			Car car = new Car();
			car.setcId(dto.getId());
			car.setVin(dto.getVin());
			list.add(car);
		}
		return list;
	}
	
	/**
	 * 车架号取得
	 * 
	 * @param vin
	 * @return
	 * @throws TmsDaoException
	 */
	public List<Car> findVinList(String vin,String memberId) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		List<MarketCarInfoDto> dtoList = carDao.findVinList(vin,memberId);
		List<Car> list = new ArrayList<Car>();
		for (MarketCarInfoDto dto : dtoList) {
			Car car = new Car();
			car.setcId(dto.getId());
			car.setVin(dto.getVin());
			list.add(car);
		}
		return list;
	}
	
	public List<Car> findBaseCarInfoVinList(String vin) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		List<BaseCarInfoDto> dtoList = carDao.findBaseCarInfoVinList(vin);
		List<Car> list = new ArrayList<Car>();
		for (BaseCarInfoDto dto : dtoList) {
			Car car = new Car();
			car.setcId(dto.getId());
			car.setVin(dto.getVin());
			list.add(car);
		}
		return list;
	}

	public List<Car> findVinListByRegisterStatus(String vin) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		List<MarketCarInfoDto> dtoList = carDao.findVinListByRegisterStatus(vin);
		List<Car> list = new ArrayList<Car>();
		for (MarketCarInfoDto dto : dtoList) {
			Car car = new Car();
			car.setcId(dto.getId());
			car.setVin(dto.getVin());
			list.add(car);
		}
		return list;
	}
	
	/**
	 * 通过车架号查询车辆信息List
	 * 
	 * @param vin
	 * @return
	 * @throws TmsDaoException
	 */
	public List<Car> findCarInfoListByVin(String vin) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		List<MarketCarInfoDto> dtoList = carDao.findCarInfoListByVin(vin);
		List<Car> list = new ArrayList<Car>();
		for (MarketCarInfoDto dto : dtoList) {
			Car car = new Car();
			car.setId(dto.getMId());
			car.setVin(dto.getVin());
			car.setMemberId(dto.getMemberId());
			car.setSerial(dto.getSerial());
			car.setRegisterStatus(dto.getRegisterStatus());
			car.setTempLicensePlate(dto.getTempLicensePlate());
			car.setUpdateTime(dto.getUpdateTime());
			list.add(car);
		}
		return list;
	}

	public void updateCarMatchInfo(Car car, int tag1Skip, int tag2Skip) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto.setMId(car.getId());
		dto.setPhoto_1(car.getPhoto_1());
		dto.setPhoto_2(car.getPhoto_2());
		dto.setPhoto_3(car.getPhoto_3());
		dto.setPhoto_4(car.getPhoto_4());
		dto.setPhoto_5(car.getPhoto_5());
		dto.setPhoto_6(car.getPhoto_6());
		dto.setPhoto_7(car.getPhoto_7());
		dto.setPhoto_8(car.getPhoto_8());
		dto.setMileage(car.getMileage());
		dto.setAttestStatus(car.getAttestStatus());
		dto.setUpdateUserId(car.getUpdateUserId());
		dto.setEntryStatus(car.getEntryStatus());
		dto.setColor(car.getColor());
		dto.setTempLicensePlate(car.getTempLicensePlate());
		carDao.updateCarMatchInfo(dto, tag1Skip, tag2Skip);
	}

	public void updateMarketCarIsMatchInfo(Car car, int tag1Skip, int tag2Skip) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto dto = new MarketCarInfoDto();
		dto.setSerial(car.getSerial());
		dto.setPhoto_1(car.getPhoto_1());
		dto.setPhoto_2(car.getPhoto_2());
		dto.setPhoto_3(car.getPhoto_3());
		dto.setPhoto_4(car.getPhoto_4());
		dto.setPhoto_5(car.getPhoto_5());
		dto.setPhoto_6(car.getPhoto_6());
		dto.setPhoto_7(car.getPhoto_7());
		dto.setPhoto_8(car.getPhoto_8());
		dto.setMileage(car.getMileage());
		dto.setAttestStatus(car.getAttestStatus());
		dto.setEntryStatus(car.getEntryStatus());
		dto.setColor(car.getColor());
		dto.setTempLicensePlate(car.getTempLicensePlate().toUpperCase());
		carDao.updateMarketCarIsMatchInfo(dto, tag1Skip, tag2Skip);
	}

	public String findShortNameBySerial(String serial) throws TmsDaoException {
		String shortName = "";
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		shortName = carDao.findShortNameBySerial(serial);
		return shortName;
	}

	public void setIsMatch(int isMatch) {
		this.isMatch = isMatch;
	}

	public int getIsMatch() {
		return isMatch;
	}

	public void setChgLicensePlateTimes(String chgLicensePlateTimes) {
		this.chgLicensePlateTimes = chgLicensePlateTimes;
	}

	public String getChgLicensePlateTimes() {
		return chgLicensePlateTimes;
	}

	public void setEnterTimes(String enterTimes) {
		this.enterTimes = enterTimes;
	}

	public String getEnterTimes() {
		return enterTimes;
	}

	public void setStorageTimes(String storageTimes) {
		this.storageTimes = storageTimes;
	}

	public String getStorageTimes() {
		return storageTimes;
	}

	public void setCatClass(int catClass) {
		this.catClass = catClass;
	}

	public int getCatClass() {
		return catClass;
	}

	/**
	 * @param checkStatus
	 *            the checkStatus to set
	 */
	public void setCheckStatus(int checkStatus) {
		this.checkStatus = checkStatus;
	}

	/**
	 * @return the checkStatus
	 */
	public int getCheckStatus() {
		return checkStatus;
	}

	/**
	 * @param checkImgPath
	 *            the checkImgPath to set
	 */
	public void setCheckImgPath(String checkImgPath) {
		this.checkImgPath = checkImgPath;
	}

	/**
	 * @return the checkImgPath
	 */
	public String getCheckImgPath() {
		return checkImgPath;
	}

	/**
	 * @param checkUserName
	 *            the checkUserName to set
	 */
	public void setCheckUserName(String checkUserName) {
		this.checkUserName = checkUserName;
	}

	/**
	 * @return the checkUserName
	 */
	public String getCheckUserName() {
		return checkUserName;
	}

	/**
	 * @param checkTime
	 *            the checkTime to set
	 */
	public void setCheckTime(String checkTime) {
		this.checkTime = checkTime;
	}

	/**
	 * @return the checkTime
	 */
	public String getCheckTime() {
		return checkTime;
	}

	/**
	 * @param checkPriceStatus
	 *            the checkPriceStatus to set
	 */
	public void setCheckPriceStatus(String checkPriceStatus) {
		this.checkPriceStatus = checkPriceStatus;
	}

	/**
	 * @return the checkPriceStatus
	 */
	public String getCheckPriceStatus() {
		return checkPriceStatus;
	}

	/**
	 * @param isExistFlag
	 *            the isExistFlag to set
	 */
	public void setIsExistFlag(int isExistFlag) {
		this.isExistFlag = isExistFlag;
	}

	/**
	 * @return the isExistFlag
	 */
	public int getIsExistFlag() {
		return isExistFlag;
	}

	/**
	 * 特权车一览搜索
	 * 
	 * @author zhao-qc
	 * @return 特权车信息
	 * @throws TmsDaoException
	 */
	public List<MarketCarInfoDto> findPrivilegeCarResult() throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		List<MarketCarInfoDto> marketCarList = carDao.findPrivilegeCar();
		return marketCarList;
	}

	/**
	 * 插入特权车信息
	 * 
	 * @author zhao-qc
	 * @param dto
	 *            车辆信息
	 * @throws TmsDaoException
	 */
	public void savePrivilegeCarInfo(MarketCarInfoDto dto) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.savePrivilegeCarInfo(dto);
	}

	/**
	 * 查询易碎贴编号是否存在
	 * 
	 * @author zhao-qc
	 * @param tempLicensePlate
	 *            易碎贴编号
	 * @return 易碎贴编号
	 * @throws TmsDaoException
	 */
	public String findInputInfoTemLP(String tempLicensePlate) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		String temLP = carDao.findInputInfoTemLP(tempLicensePlate);
		return temLP;
	}

	/**
	 * 查询车牌号码是否存在
	 * 
	 * @author zhao-qc
	 * @param licensePlate
	 *            车牌号码
	 * @return 车牌号码
	 * @throws TmsDaoException
	 */
	public String findInputInfoLP(String licensePlate) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		String lp = carDao.findInputInfoLP(licensePlate);
		return lp;
	}

	/**
	 * 要修改信息的特权车搜索
	 * 
	 * @author zhao-qc
	 * @param priviId
	 *            特权车ID
	 * @return 要修改信息的特权特权车信息
	 * @throws TmsDaoException
	 */
	public MarketCarInfoDto findUpdatePriCarResult(String priviId) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		MarketCarInfoDto marketCarDto = carDao.findUpdatePriCarResult(priviId);
		return marketCarDto;
	}

	/**
	 * 更新特权车信息
	 * 
	 * @author zhao-qc
	 * @param dto
	 *            车辆信息
	 * @throws TmsDaoException
	 */
	public void updatePrivilegeCarInfo(MarketCarInfoDto dto) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updatePrivilegeCarInfo(dto);
	}

	/**
	 * 自助打印-新车上牌
	 * 
	 * @param vin
	 * @throws TmsDaoException
	 * @author
	 */
	public List<TransferAcceptedInfoDto> loadCarAutoTerminalBrandNewCarList(String vin) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);
		// 新车上牌list
		List<TransferAcceptedInfoDto> carlist = carDao.loadCarAutoTerminalBrandNewCarList(vin);

		setPagingInfo(idao);
		return carlist;
	}

	/**
	 * 更新查验信息
	 * 
	 * @throws TmsDaoException
	 * 
	 */
	public void updateTransferCyPrintNumByVin(TransferAcceptedInfoDto dto) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		carDao.updateTransferCyPrintNumByVin(dto);
	}

	/**
	 * 自助打印-二手车上牌
	 * 
	 * @param dto
	 * @throws TmsDaoException
	 * @author
	 */
	public List<TransferAcceptedInfoDto> loadCarAutoTerminalSecondHandList(TransferAcceptedInfoDto dto)
			throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		ViewListDao idao = (ViewListDao) TmsDao.getViewListDao((TmsDao) carDao, TmsDao.TMS_CAR);
		// 二手车上牌list
		List<TransferAcceptedInfoDto> carlist = carDao.loadCarAutoTerminalSecondHandList(dto);

		setPagingInfo(idao);
		return carlist;
	}

	/**
	 * 更新查验信息
	 * 
	 * @throws TmsDaoException
	 * 
	 */
	public void updateTransferCyPrintNumByLicensePlate(TransferAcceptedInfoDto dto) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR, getPageNo(), getMaxIndex(), getSortKey(), isAsc());
		carDao.updateTransferCyPrintNumByLicensePlate(dto);
	}

	/**
	 * 关联的库存车辆业务信息表（tms_market_car_service）
	 * 流程表缴费（checkPrice）+交易票缴费（transferPrice）
	 * 
	 * @param serial
	 * @return
	 * @throws TmsDaoException
	 */
	public MarketCarServiceDto findMarketCarService(String serial) throws TmsDaoException {
		CarDao dao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		return dao.findMarketCarService(serial);
	}

	/**
	 * 更新 会员基本信息数据表（tms_member）
	 * 
	 * @param car
	 * @return
	 * @throws TmsDaoException
	 */
	public void updateMember(int memberId, int price) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateMember(memberId, price);
	}

	/**
	 * 更新 库存车辆业务表（tms_market_car_service）
	 * 
	 * @param serial
	 */
	public void updateMarketCarService(String serial) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateMarketCarService(serial);
	}

	/**
	 * @param cylc_printNum
	 *            the cylc_printNum to set
	 */
	public void setCylc_printNum(int cylc_printNum) {
		this.cylc_printNum = cylc_printNum;
	}

	/**
	 * @return the cylc_printNum
	 */
	public int getCylc_printNum() {
		return cylc_printNum;
	}

	/**
	 * @param lc_printNum
	 *            the lc_printNum to set
	 */
	public void setLc_printNum(int lc_printNum) {
		this.lc_printNum = lc_printNum;
	}

	/**
	 * @return the lc_printNum
	 */
	public int getLc_printNum() {
		return lc_printNum;
	}

	/**
	 * @param cy_printNum
	 *            the cy_printNum to set
	 */
	public void setCy_printNum(int cy_printNum) {
		this.cy_printNum = cy_printNum;
	}

	/**
	 * @return the cy_printNum
	 */
	public int getCy_printNum() {
		return cy_printNum;
	}

	/**
	 * 更新 库存车辆业务表（tms_market_car_service）
	 * 
	 * @param serial
	 */
	public void updateMarketCarServiceByMq203(String serial, int checkPrice, int changePrice) throws TmsDaoException {
		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
		carDao.updateMarketCarServiceByMq203(serial, checkPrice, changePrice);
	}

	public Timestamp getTmpStorageTime() {
		return tmpStorageTime;
	}

	public void setTmpStorageTime(Timestamp tmpStorageTime) {
		this.tmpStorageTime = tmpStorageTime;
	}

	public Timestamp getTmpEnterTime() {
		return tmpEnterTime;
	}

	public void setTmpEnterTime(Timestamp tmpEnterTime) {
		this.tmpEnterTime = tmpEnterTime;
	}

	public void setConfigKey(String configKey) {
		this.configKey = configKey;
	}

	public String getConfigKey() {
		return configKey;
	}

	public void setAcceptorImage(String acceptorImage) {
		this.acceptorImage = acceptorImage;
	}

	public String getAcceptorImage() {
		return acceptorImage;
	}

	public void setInsertTimeUpadateFlg(boolean insertTimeUpadateFlg) {
		this.insertTimeUpadateFlg = insertTimeUpadateFlg;
	}

	public boolean isInsertTimeUpadateFlg() {
		return insertTimeUpadateFlg;
	}
	public void updateMarketCarInfoByVin(String vin,String licensePlate) throws TmsDaoException {
        CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
        MarketCarInfoDto marketCarInfoDto = new MarketCarInfoDto();
        marketCarInfoDto.setVin(vin);
        marketCarInfoDto.setLicensePlate(licensePlate);
        carDao.updateMarketCarInfoByVin(marketCarInfoDto);
        
	}
	
	public List<MarketCarVendorMonthCountDto> findYearlyReport() throws TmsDaoException{
		MarketCarVendorCountDao dao = (MarketCarVendorCountDaoImpl) TmsDao.getInstance(TmsDao.MarketCarVendorCount);
		return dao.findYearlyReport();
	}
	
	public List<MarketCarVendorMonthCountDto> findMonthlyReport(String year) throws TmsDaoException{
		MarketCarVendorCountDao dao = (MarketCarVendorCountDaoImpl) TmsDao.getInstance(TmsDao.MarketCarVendorCount);
		return dao.findMonthlyReport(year);
	}
	
	public List<MarketCarVendorMonthCountDto> findDailyReport(String year, String month) throws TmsDaoException{
		MarketCarVendorCountDao dao = (MarketCarVendorCountDaoImpl) TmsDao.getInstance(TmsDao.MarketCarVendorCount);
		return dao.findDailyReport(year, month);
	}

//	public List<MarketCarInfoDto> findStatisticsList(CarStatisticsConditions car) throws TmsDaoException {
//		List<MarketCarInfoDto> statisticsList = new ArrayList<MarketCarInfoDto>();
//		CommercialVehicleDao commericalDao = (CommercialVehicleDao) TmsDao.getInstance(TmsDao.TMS_COMMERCIAL_VEHICLE);
//		List<CommercialVehicleDto> commercialList = commericalDao.loadAllCommercialVendor();
//		CarCodesDao dao = new CarCodesDaoImp();
//		List<CarCodesDto> vendorList = dao.findCarCodesList();
//		CarDao carDao = (CarDao) TmsDao.getInstance(TmsDao.TMS_CAR);
//		List<MarketCarInfoDto> all = carDao.findStatisticsList(car);
//		BigDecimal statisticsCount = BigDecimal.ZERO;
//		BigDecimal statisticsPrice = BigDecimal.ZERO;
//		for (MarketCarInfoDto dto : all) {
//			statisticsCount = statisticsCount.add(new BigDecimal(dto.getCount()));
//			statisticsPrice = statisticsPrice.add(new BigDecimal(dto.getTotalPrice()));
//			dto.setStatisticsCount(dto.getCount());
//			dto.setStatisticsPrice(dto.getTotalPrice());
//			if(dto.getCatClass() == 1) {// 1：商用车
//				dto.setBrandName(getCommercialBrandName(dto.getBrandId(), commercialList));
//				dto.setVendorName(getCommercialVendorName(dto.getVendorId(), commercialList));
//			} else {//2：乘用车
//				dto.setBrandName(getBrandName(dto.getBrandId(), vendorList));
//				dto.setVendorName(getVendorName(dto.getVendorId(), vendorList));
//			}
//			if(car.getGroupBy().length >= 1) {
//				String groupBy = car.getGroupBy()[0];
//				if(groupBy.equals("vendorId")) {
//					dto.setStr0(dto.getVendorName());
//				} else if(groupBy.equals("brandId")) {
//					dto.setStr0(dto.getBrandName());
//				} else if(groupBy.equals("dateGroup")) {
//					dto.setStr0(dto.getDateGroupStr());
//				} else if(groupBy.equals("priceGroup")) {
//					dto.setStr0(dto.getPriceGroupStr());
//				} else if(groupBy.equals("memberId")) {
//					dto.setStr0(dto.getShortName());
//				}
//				dto.setStatisticsName(dto.getStr0());
//			} 
//			if (car.getGroupBy().length >= 2) {
//				String groupBy = car.getGroupBy()[1];
//				if(groupBy.equals("vendorId")) {
//					dto.setStr1(dto.getVendorName());
//				} else if(groupBy.equals("brandId")) {
//					dto.setStr1(dto.getBrandName());
//				} else if(groupBy.equals("dateGroup")) {
//					dto.setStr1(dto.getDateGroupStr());
//				} else if(groupBy.equals("priceGroup")) {
//					dto.setStr1(dto.getPriceGroupStr());
//				} else if(groupBy.equals("memberId")) {
//					dto.setStr1(dto.getShortName());
//				}
//				dto.setStatisticsName(dto.getStr1());
//			} 
//			if (car.getGroupBy().length >= 3) {
//				String groupBy = car.getGroupBy()[2];
//				if(groupBy.equals("vendorId")) {
//					dto.setStr2(dto.getVendorName());
//				} else if(groupBy.equals("brandId")) {
//					dto.setStr2(dto.getBrandName());
//				} else if(groupBy.equals("dateGroup")) {
//					dto.setStr2(dto.getDateGroupStr());
//				} else if(groupBy.equals("priceGroup")) {
//					dto.setStr2(dto.getPriceGroupStr());
//				} else if(groupBy.equals("memberId")) {
//					dto.setStr2(dto.getShortName());
//				}
//				dto.setStatisticsName(dto.getStr2());
//			} 
//			if (car.getGroupBy().length >= 4) {
//				String groupBy = car.getGroupBy()[3];
//				if(groupBy.equals("vendorId")) {
//					dto.setStr3(dto.getVendorName());
//				} else if(groupBy.equals("brandId")) {
//					dto.setStr3(dto.getBrandName());
//				} else if(groupBy.equals("dateGroup")) {
//					dto.setStr3(dto.getDateGroupStr());
//				} else if(groupBy.equals("priceGroup")) {
//					dto.setStr3(dto.getPriceGroupStr());
//				} else if(groupBy.equals("memberId")) {
//					dto.setStr3(dto.getShortName());
//				}
//				dto.setStatisticsName(dto.getStr3());
//			} 
//			if (car.getGroupBy().length >= 5) {
//				String groupBy = car.getGroupBy()[4];
//				if(groupBy.equals("vendorId")) {
//					dto.setStr4(dto.getVendorName());
//				} else if(groupBy.equals("brandId")) {
//					dto.setStr4(dto.getBrandName());
//				} else if(groupBy.equals("dateGroup")) {
//					dto.setStr4(dto.getDateGroupStr());
//				} else if(groupBy.equals("priceGroup")) {
//					dto.setStr4(dto.getPriceGroupStr());
//				} else if(groupBy.equals("memberId")) {
//					dto.setStr4(dto.getShortName());
//				}
//				dto.setStatisticsName(dto.getStr4());
//			}
//		}
//		//
//		MarketCarInfoDto statistics = new MarketCarInfoDto();
//		statistics.setStatisticsName("合计");
//		statistics.setStatisticsCount(statisticsCount.toPlainString());
//		statistics.setStatisticsPrice(statisticsPrice.toPlainString());
//		statisticsList.add(statistics);
//		
//		//
//		Map<String, MarketCarInfoDto> map0 = new HashMap<String, MarketCarInfoDto>();
//		for (MarketCarInfoDto dto : all) {
//			MarketCarInfoDto name = map0.get(dto.getStr0());
//			if(name == null) {name = new MarketCarInfoDto(); map0.put(dto.getStr0(), name);}
//			if(name.getStatisticsCount() == null) {name.setStatisticsCount("0");}
//			if(name.getStatisticsPrice() == null) {name.setStatisticsPrice("0");}
//			name.setStr0(dto.getStr0());
//			name.setStr1(dto.getStr1());
//			name.setStr2(dto.getStr2());
//			name.setStr3(dto.getStr3());
//			name.setStr4(dto.getStr4());
//			name.setStatisticsName(dto.getStr0());
//			name.setStatisticsCount(new BigDecimal(name.getStatisticsCount()).add(new BigDecimal(dto.getStatisticsCount())).toPlainString());
//			name.setStatisticsPrice(new BigDecimal(name.getStatisticsPrice()).add(new BigDecimal(dto.getStatisticsPrice())).toPlainString());
//		}
//		
//		Map<String, MarketCarInfoDto> map1 = new HashMap<String, MarketCarInfoDto>();
//		if(car.getGroupBy().length >= 2) {
//			for (MarketCarInfoDto dto : all) {
//				String key = dto.getStr0()+"|"+dto.getStr1();
//				MarketCarInfoDto name = map1.get(key);
//				if(name == null) {name = new MarketCarInfoDto(); map1.put(key, name);}
//				name.setStr0(dto.getStr0());
//				name.setStr1(dto.getStr1());
//				name.setStr2(dto.getStr2());
//				name.setStr3(dto.getStr3());
//				name.setStr4(dto.getStr4());
//				name.setStatisticsName(dto.getStr1());
//				if(name.getStatisticsCount() == null) {name.setStatisticsCount("0");}
//				if(name.getStatisticsPrice() == null) {name.setStatisticsPrice("0");}
//				name.setStatisticsCount(new BigDecimal(name.getStatisticsCount()).add(new BigDecimal(dto.getStatisticsCount())).toPlainString());
//				name.setStatisticsPrice(new BigDecimal(name.getStatisticsPrice()).add(new BigDecimal(dto.getStatisticsPrice())).toPlainString());
//			}
//		}
//		
//		Map<String, MarketCarInfoDto> map2 = new HashMap<String, MarketCarInfoDto>();
//		if(car.getGroupBy().length >= 3) {
//			for (MarketCarInfoDto dto : all) {
//				String key = dto.getStr0()+"|"+dto.getStr1() + "|" + dto.getStr2();
//				MarketCarInfoDto name = map2.get(key);
//				if(name == null) {name = new MarketCarInfoDto(); map2.put(key, name);}
//				if(name.getStatisticsCount() == null) {name.setStatisticsCount("0");}
//				if(name.getStatisticsPrice() == null) {name.setStatisticsPrice("0");}
//				name.setStr0(dto.getStr0());
//				name.setStr1(dto.getStr1());
//				name.setStr2(dto.getStr2());
//				name.setStr3(dto.getStr3());
//				name.setStr4(dto.getStr4());
//				name.setStatisticsName(dto.getStr2());
//				name.setStatisticsCount(new BigDecimal(name.getStatisticsCount()).add(new BigDecimal(dto.getStatisticsCount())).toPlainString());
//				name.setStatisticsPrice(new BigDecimal(name.getStatisticsPrice()).add(new BigDecimal(dto.getStatisticsPrice())).toPlainString());
//			}
//		}
//		
//		Map<String, MarketCarInfoDto> map3 = new HashMap<String, MarketCarInfoDto>();
//		if(car.getGroupBy().length >= 4) {
//			for (MarketCarInfoDto dto : all) {
//				String key = dto.getStr0()+"|"+dto.getStr1() + "|" + dto.getStr2()+ "|" + dto.getStr3();
//				MarketCarInfoDto name = map3.get(key);
//				if(name == null) {name = new MarketCarInfoDto(); map3.put(key, name);}
//				if(name.getStatisticsCount() == null) {name.setStatisticsCount("0");}
//				if(name.getStatisticsPrice() == null) {name.setStatisticsPrice("0");}
//				name.setStr0(dto.getStr0());
//				name.setStr1(dto.getStr1());
//				name.setStr2(dto.getStr2());
//				name.setStr3(dto.getStr3());
//				name.setStr4(dto.getStr4());
//				name.setStatisticsName(dto.getStr3());
//				name.setStatisticsCount(new BigDecimal(name.getStatisticsCount()).add(new BigDecimal(dto.getStatisticsCount())).toPlainString());
//				name.setStatisticsPrice(new BigDecimal(name.getStatisticsPrice()).add(new BigDecimal(dto.getStatisticsPrice())).toPlainString());
//			}
//		}
//		
//		Map<String, MarketCarInfoDto> map4 = new HashMap<String, MarketCarInfoDto>();
//		if(car.getGroupBy().length >= 5) {
//			for (MarketCarInfoDto dto : all) {
//				String key = dto.getStr0()+"|"+dto.getStr1() + "|" + dto.getStr2()+ "|" + dto.getStr3()+ "|" + dto.getStr4();
//				MarketCarInfoDto name = map4.get(key);
//				if(name == null) {name = new MarketCarInfoDto(); map4.put(key, name);}
//				if(name.getStatisticsCount() == null) {name.setStatisticsCount("0");}
//				if(name.getStatisticsPrice() == null) {name.setStatisticsPrice("0");}
//				name.setStr0(dto.getStr0());
//				name.setStr1(dto.getStr1());
//				name.setStr2(dto.getStr2());
//				name.setStr3(dto.getStr3());
//				name.setStr4(dto.getStr4());
//				name.setStatisticsName(dto.getStr4());
//				name.setStatisticsCount(new BigDecimal(name.getStatisticsCount()).add(new BigDecimal(dto.getStatisticsCount())).toPlainString());
//				name.setStatisticsPrice(new BigDecimal(name.getStatisticsPrice()).add(new BigDecimal(dto.getStatisticsPrice())).toPlainString());
//			}
//		}
//		
//		//
//		ArrayList<MarketCarInfoDto> l0 = orderBy(Lists.newArrayList(map0.values().iterator()), car.getOrderBy());
//		ArrayList<MarketCarInfoDto> l1 = orderBy(Lists.newArrayList(map1.values().iterator()), car.getOrderBy());
//		ArrayList<MarketCarInfoDto> l2 = orderBy(Lists.newArrayList(map2.values().iterator()), car.getOrderBy());
//		ArrayList<MarketCarInfoDto> l3 = orderBy(Lists.newArrayList(map3.values().iterator()), car.getOrderBy());
//		ArrayList<MarketCarInfoDto> l4 = orderBy(Lists.newArrayList(map4.values().iterator()), car.getOrderBy());
//		for (MarketCarInfoDto info : l0) {
//			statisticsList.add(info);
//			for (MarketCarInfoDto info1 : l1) {
//				if(info1.getStr0()!=null && info1.getStr0().equals(info.getStr0())) {
//					info1.setStatisticsName("="+info1.getStatisticsName());
//					statisticsList.add(info1);
//					for (MarketCarInfoDto info2 : l2) {
//						if(info2.getStr0()!=null &&info2.getStr0().equals(info.getStr0()) && info2.getStr1().equals(info1.getStr1())) {
//							info2.setStatisticsName("=="+info2.getStatisticsName());
//							statisticsList.add(info2);
//							for (MarketCarInfoDto info3 : l3) {
//								if(info3.getStr0()!=null && info3.getStr0().equals(info.getStr0()) && info3.getStr1().equals(info1.getStr1())
//										&& info3.getStr2().equals(info2.getStr2())) {
//									info3.setStatisticsName("==="+info3.getStatisticsName());
//									statisticsList.add(info3);
//									for (MarketCarInfoDto info4 : l4) {
//										if(info4.getStr0()!=null &&  info4.getStr0().equals(info.getStr0()) && info4.getStr1().equals(info1.getStr1())
//												&& info4.getStr2().equals(info2.getStr2()) && info4.getStr3().equals(info3.getStr3())) {
//											info4.setStatisticsName("===="+info4.getStatisticsName());
//											statisticsList.add(info4);
//										}
//									}
//								}
//							}
//						}
//					}
//				}
//			}
//		}
//
//		for (MarketCarInfoDto info : statisticsList) info.setStatisticsPrice(format.format(new BigDecimal(info.getStatisticsPrice())));
//		return statisticsList;
//	}
	
	
	private ArrayList<MarketCarInfoDto> orderBy(ArrayList<MarketCarInfoDto> l0, String orderBy) {
		if(orderBy.indexOf("price")>=0) {
			if(orderBy.indexOf("desc")>=0) {
				Collections.sort(l0, priceCompDesc);
			} else {
				Collections.sort(l0, priceCompAsc);
			}
		} else {
			if(orderBy.indexOf("desc")>=0) {
				Collections.sort(l0, countCompDesc);
			} else {
				Collections.sort(l0, countCompAsc);
			}	
		}
		return l0;
	}
	
	
	private String getCommercialVendorName(String vendorId, List<CommercialVehicleDto> list) {
		if(list==null) return "";
		for (CommercialVehicleDto commercialVehicleDto : list) {
			if(commercialVehicleDto.getVendorId().equals(vendorId)) return commercialVehicleDto.getVendorName();
		}
		return "";
	}
	
	private String getVendorName(String vendorId, List<CarCodesDto> list) {
		if(list==null) return "";
		for (CarCodesDto dto : list) {
			if(dto.getVendorId().equals(vendorId)) return dto.getVendorName();
		}
		return "";
	}
	
	private String getCommercialBrandName(String brandId, List<CommercialVehicleDto> list) {
		if(list==null) return "";
		for (CommercialVehicleDto commercialVehicleDto : list) {
			if(commercialVehicleDto.getBrandId().equals(brandId)) return commercialVehicleDto.getBrandName();
		}
		return "";
	}
	
	private String getBrandName(String brandId, List<CarCodesDto> list) {
		if(list==null) return "";
		for (CarCodesDto dto : list) {
			if(brandId.equals(dto.getBrandId())) return dto.getBrandName();
		}
		return "";
	}
	
    
	private static PriceComparator priceCompAsc = new  PriceComparator(true);
	private static PriceComparator priceCompDesc = new  PriceComparator(false);
	private static CountComparator countCompAsc = new  CountComparator(true);
	private static CountComparator countCompDesc = new  CountComparator(false);
	
	
	public static final class CountComparator implements Comparator<MarketCarInfoDto> {
		private final boolean asc;
		public CountComparator(boolean asc) { this.asc = asc; }
		@Override public int compare(MarketCarInfoDto v1, MarketCarInfoDto v2) {
			if(v1.getStatisticsCount() == null || v2.getStatisticsCount()==null ) return 1;
			return asc ? new BigDecimal(v1.getStatisticsCount()).compareTo(new BigDecimal(v2.getStatisticsCount())) : -(new BigDecimal(v1.getStatisticsCount()).compareTo(new BigDecimal(v2.getStatisticsCount()))); }
	}
	
	public static final class PriceComparator implements Comparator<MarketCarInfoDto> {
		private final boolean asc;
		public PriceComparator(boolean asc) { this.asc = asc; }
		@Override public int compare(MarketCarInfoDto v1, MarketCarInfoDto v2) {
			if(v1.getStatisticsPrice() == null || v2.getStatisticsPrice()==null) return 1;
			return asc ? new BigDecimal(v1.getStatisticsPrice()).compareTo(new BigDecimal(v2.getStatisticsPrice())) : -(new BigDecimal(v1.getStatisticsPrice()).compareTo(new BigDecimal(v2.getStatisticsPrice()))); }
	}
}
